Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Quickest way to host a single file on VPS?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Quickest way to host a single file on VPS?

Hey folks, I have to host a single file on my vps... 1GB or less. No authentication... LetsEncrypt SSL will be good to serve it.

What will be a quick way to spin off a webserver? The VPS run Debian/ Centos.

Comments

  • DPDP Administrator, The Domain Guy

    SimpleHTTPServer?

  • dahartigandahartigan Member
    edited September 2021

    @DP said:
    SimpleHTTPServer?

    I'll elaborate ;)

    Install python and run in the directory you want to serve from:

    python -m SimpleHTTPServer 8080

    Where 8080 is the port it will listen on.

  • DPDP Administrator, The Domain Guy
    edited September 2021

    @dahartigan said:

    @DP said:
    SimpleHTTPServer?

    I'll elaborate ;)

    Install python and run in the directory you want to serve from:

    python -m SimpleHTTPServer 8080

    Where 8080 is the port it will listen on.

    Then there's also python3 -m http.server 8080 or whatever port you'd like that's not used.

  • loydloyd Member
    edited September 2021

    Assuming root, Debian/Ubuntu no SSL

    apt install nginx
    mv file-to-host /var/www/html

    If you want to add SSL with LetsEncrypt certificate:

    apt install certbot python3-certbot-nginx
    nano /etc/nginx/sites-available/default # change server_name to domain.tld
    certbot --nginx -d domain.tld # follow prompts

    Done.

    Alternatively a 1-liner to install full OpenLiteSpeed+PHP+MariaDB stack:

    wget -O - https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh | bash
    mv file-to-host /usr/local/lsws/Example/html

    The default website comes with self-signed SSL.

  • Caddy.

    Thanked by 3plumberg tjn salakis
  • raindog308raindog308 Administrator, Veteran

    @plumberg said: I have to host a single file on my vps

    Depending on what you're doing, it may be easier to put it on Github, Dropbox, Google Drive, etc. and share a link rather than have a vps, webserver, etc. just for a single file.

    Thanked by 2plumberg webcraft
  • @DP said:

    @dahartigan said:

    @DP said:
    SimpleHTTPServer?

    I'll elaborate ;)

    Install python and run in the directory you want to serve from:

    python -m SimpleHTTPServer 8080

    Where 8080 is the port it will listen on.

    Then there's also python3 -m http.server 8080 or whatever port you'd like that's not used.

    Just to add, one needs to enable the port on firewall

    Thanked by 1webcraft
  • @raindog308 said:

    @plumberg said: I have to host a single file on my vps

    Depending on what you're doing, it may be easier to put it on Github, Dropbox, Google Drive, etc. and share a link rather than have a vps, webserver, etc. just for a single file.

    Yes. Had a couple idlers. Thought to put them to some use 😎

    Thanked by 1raindog308
  • raindog308raindog308 Administrator, Veteran

    @plumberg said: Yes. Had a couple idlers.

    image

    Thanked by 2plumberg Ympker
  • @plumberg said:

    @raindog308 said:

    @plumberg said: I have to host a single file on my vps

    Depending on what you're doing, it may be easier to put it on Github, Dropbox, Google Drive, etc. and share a link rather than have a vps, webserver, etc. just for a single file.

    Yes. Had a couple idlers. Thought to put them to some use 😎

    This problem intensifies when you have a dedicated server with a /29 and you only really need 1 IP.. idling IPs isn't fun, so I've just (in the last 5 mins) created a VPS with one of them idling IPs to dump files on - similar to what you're doing here I guess.

    Thanked by 1plumberg
  • There are webservers that support Let's Encrypt out of the box. Such as Caddy.

    Thanked by 1plumberg
  • farsighterfarsighter Member
    edited September 2021

    rclone can easily do all. Serving, SSL, authentication, BW limits and much more.
    It's better than SimpleHTTPServer which is limited to a single connection at a time.

    I can post some examples later if anyone needs.

  • Assuming debian:

    wget https://github.com/caddyserver/caddy/releases/download/v2.4.5/caddy_2.4.5_linux_s390x.deb

    dpkg -i caddy_2.4.5_linux_s390x.deb

    caddy file-server /path/to/file

    optionally --listen :port

    Thanked by 2plumberg yoursunny
  • @farsighter said:
    rclone can easily do all. Serving, SSL, authentication, BW limits and much more.
    It's better than SimpleHTTPServer which is limited to a single connection at a time.

    I can post some examples later if anyone needs.

    Interesting. Can you please share details?

  • yoursunnyyoursunny Member, IPv6 Advocate

    @plumberg said:

    @farsighter said:
    rclone can easily do all. Serving, SSL, authentication, BW limits and much more.
    It's better than SimpleHTTPServer which is limited to a single connection at a time.

    I can post some examples later if anyone needs.

    Interesting. Can you please share details?

    https://rclone.org/commands/rclone_serve_http/

    Thanked by 1plumberg
  • farsighterfarsighter Member
    edited September 2021

    @plumberg said:
    Interesting. Can you please share details?

    rclone is a fantastic tool which lets you (among many other things) serve local files. You won't need any cloud provider (aka 'remote') or other preparations in order to use the following examples for your goal. Just 'apt-get install rclone'.

    Now I'll give you some examples to play with.

    The following command will simply serve files from current directory over HTTP on port 8080 :
    rclone serve http --addr :8080 . &
    You can replace that dot with any full path of course. Access from http://IP:8080/

    If you want to serve only a specific file from current directory over HTTP on port 8080, do like this:
    rclone serve http --addr :8080 ./filename.ext &

    The following one will serve files from current directory over HTTPS + authentication on port 8080:
    rclone serve http --user username --pass password --cert /path/to/certificate.pem --key /path/to/key.pem --addr :8080 . &
    Access from https://IP:8080/.
    (Just remove --user and --pass flags if you only require SSL without authentication).

    The above 3 commands will simply serve your file/s as directory listing which may be enough for you, but some people may consider "ugly".

    In case you want to craft your own welcome HTML page and directly serve your file through it then you should add the --template flag and specify your landing HTML file, like this:
    rclone serve http --user username --pass password --cert /path/to/certificate.pem --key /path/to/key.pem --addr :8080 . --template index.html &

    In index.html you can put anything like:
    <h1>This file will only be available this week.</h1>
    <a href="filename.ext">Download!</a>
    and so on...
    Then https://IP:8080/ will directly output the selected HTML page.

    • As you can see all examples above end with '&' in order to send rclone to the background and free the shell. That's how I use it in my snippets, however while learning/debugging you'd better skip it and add the -v option in order to turn output verbose.

    Full doc for 'rclone serve http' can be found here:
    https://rclone.org/commands/rclone_serve_http/

    Hope this is helpful.

  • tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Thanked by 1plumberg
  • @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    Thanked by 1webcraft
  • @farsighter said:

    @plumberg said:
    Interesting. Can you please share details?

    rclone is a fantastic tool which lets you (among many other things) serve local files. You won't need any cloud provider (aka 'remote') or other preparations in order to use the following examples for your goal. Just 'apt-get install rclone'.

    Now I'll give you some examples to play with.

    The following command will simply serve files from current directory over HTTP on port 8080 :
    rclone serve http --addr :8080 . &
    You can replace that dot with any full path of course. Access from http://IP:8080/

    If you want to serve only a specific file from current directory over HTTP on port 8080, do like this:
    rclone serve http --addr :8080 ./filename.ext &

    The following one will serve files from current directory over HTTPS + authentication on port 8080:
    rclone serve http --user username --pass password --cert /path/to/certificate.pem --key /path/to/key.pem --addr :8080 . &
    Access from https://IP:8080/.
    (Just remove --user and --pass flags if you only require SSL without authentication).

    The above 3 commands will simply serve your file/s as directory listing which may be enough for you, but some people may consider "ugly".

    In case you want to craft your own welcome HTML page and directly serve your file through it then you should add the --template flag and specify your landing HTML file, like this:
    rclone serve http --user username --pass password --cert /path/to/certificate.pem --key /path/to/key.pem --addr :8080 . --template index.html &

    In index.html you can put anything like:
    <h1>This file will only be available this week.</h1>
    <a href="filename.ext">Download!</a>
    and so on...
    Then https://IP:8080/ will directly output the selected HTML page.

    • As you can see all examples above end with '&' in order to send rclone to the background and free the shell. That's how I use it in my snippets, however while learning/debugging you'd better skip it and add the -v option in order to turn output verbose.

    Full doc for 'rclone serve http' can be found here:
    https://rclone.org/commands/rclone_serve_http/

    Hope this is helpful.

    Looks interesting. Thank you. Will definitely try

  • @plumberg said:

    @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    you need to check for file permissons. Or just chmod +x your file will fix it.

    Thanked by 1plumberg
  • @cpsd said:

    @plumberg said:

    @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    you need to check for file permissons. Or just chmod +x your file will fix it.

    I made sure all files share same permissions as index.html. but will double check.

  • @cpsd said:

    @plumberg said:

    @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    you need to check for file permissons. Or just chmod +x your file will fix it.

    Yeh. Does not work

    rw-r--r--. 1 root root 3971 Oct 7 2019 404.html
    rw-r--r--. 1 root root 4020 Oct 7 2019 50x.html
    rw-r--r--. 1 root root 4057 Oct 7 2019 index.html
    rw-r--r--. 1 root root 368 Oct 7 2019 nginx-logo.png
    rw-r--r--. 1 root root 4148 Oct 7 2019 poweredby.png
    rwxr-xr-x. 1 root root 1048576000 Sep 4 23:25 x.abc

    Last file is mine... still no luck. 403.

  • rm_rm_ IPv6 Advocate, Veteran
    edited September 2021

    If you didn't need SSL, there are:
    https://packages.debian.org/search?keywords=mini-httpd
    https://packages.debian.org/search?keywords=webfs

    If you do, Caddy might be the easiest option, at least from their claims.

    Thanked by 1plumberg
  • @plumberg said:

    @cpsd said:

    @plumberg said:

    @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    you need to check for file permissons. Or just chmod +x your file will fix it.

    Yeh. Does not work

    rw-r--r--. 1 root root 3971 Oct 7 2019 404.html
    rw-r--r--. 1 root root 4020 Oct 7 2019 50x.html
    rw-r--r--. 1 root root 4057 Oct 7 2019 index.html
    rw-r--r--. 1 root root 368 Oct 7 2019 nginx-logo.png
    rw-r--r--. 1 root root 4148 Oct 7 2019 poweredby.png
    rwxr-xr-x. 1 root root 1048576000 Sep 4 23:25 x.abc

    Last file is mine... still no luck. 403.

    https://www.digitalocean.com/community/questions/403-forbidden-nginx-13-permission-denied

    SELinux.......

    seems to work great now!

    Thanked by 1cpsd
  • To answer the question in OP, search Google, surely you'll get a response faster than LET?

  • @TimboJones said:
    To answer the question in OP, search Google, surely you'll get a response faster than LET?

    this time LET out-shined

    Thanked by 1raindog308
  • @plumberg said:

    @TimboJones said:
    To answer the question in OP, search Google, surely you'll get a response faster than LET?

    this time LET out-shined

    I can't tell from the timestamps, but it seemed like more than 12 hours instead of 15 minutes.

    Thanked by 1plumberg
  • If it's a static file, go with S3 static website (lifetime free 75GB with Scaleway) + Cloudflare.

    Thanked by 1plumberg
  • jsgjsg Member, Resident Benchmarker
    edited September 2021

    @cpsd said:

    @plumberg said:

    @JabJab said:
    tbh just apt-get install nginx because I have a feeling your next post will be "Help, my caddy/rclone/python webserver did not start automagically after reboot, how can I configure it".

    Hahahha. I am lazy and installed nginx via root login. Seem to be getting 403 error to access my file. Which is saved in the same location as default index.html

    Beats me what is causing it to go crazy

    you need to check for file permissons. Or just chmod +x your file will fix it.

    '+x'?? I guess you meant 'go+r'?

    Thanked by 1AlwaysSkint
Sign In or Register to comment.