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.

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 Member, The Domain Guy

    SimpleHTTPServer?

    DP - Tech and Hosting-related Domain Names for sale.
    Create an account on Dynadot via my referral link and spend $9.99 within 48 hours to receive $5 DynaDollars!

  • dahartigandahartigan Member
    edited September 5

    @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.

    See in my aff garden for VPS and hosting from different providers all in one place.

  • DPDP Member, The Domain Guy
    edited September 5

    @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.

    DP - Tech and Hosting-related Domain Names for sale.
    Create an account on Dynadot via my referral link and spend $9.99 within 48 hours to receive $5 DynaDollars!

  • loydloyd Member
    edited September 5

    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.

    75 20 6e 65 65 64 20 74 6f 20 67 65 74 20 6f 75 74 20 6d 6f 72 65

  • Caddy.

    Thanked by 3plumberg tjn salakis
  • raindog308raindog308 Administrator

    @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

    For LET support, please visit the support desk.

    LowEndTalk attracts the finest members. - bear, WebHostingTalk

  • @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

    @plumberg said: Yes. Had a couple idlers.

    image

    Thanked by 2plumberg Ympker

    For LET support, please visit the support desk.

    LowEndTalk attracts the finest members. - bear, WebHostingTalk

  • @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

    See in my aff garden for VPS and hosting from different providers all in one place.

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

    Thanked by 1plumberg
  • farsighterfarsighter Member
    edited September 5

    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?

  • @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

    Proof of Boomer.host selling SWAP as RAM: (1) put a file in /run/shm (2) idle for a month (3) dd if=/run/shm/random.bin of=/dev/null 23.6 MB/s https://pastebin.com/VGu969RK

  • farsighterfarsighter Member
    edited September 5

    @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

  • cpsdcpsd Member

    @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_ Member
    edited September 5

    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
  • TejyTejy Member

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

    Thanked by 1plumberg

    Your favorite dedicated and cloud technician. | Yes, my profile picture is Contabo desktop icon.

  • jsgjsg Member, Resident Benchmarker
    edited September 8

    @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

    The problem with democracy is that by definition > 85% of the voters are not particularly intelligent.

Sign In or Register to comment.