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.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
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.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.tldcertbot --nginx -d domain.tld
# follow promptsDone.
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.
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.
Just to add, one needs to enable the port on firewall
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.
There are webservers that support Let's Encrypt out of the box. Such as Caddy.
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
Interesting. Can you please share details?
https://rclone.org/commands/rclone_serve_http/
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.
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".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
Looks interesting. Thank you. Will definitely try
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.
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.
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.
https://www.digitalocean.com/community/questions/403-forbidden-nginx-13-permission-denied
SELinux.......
seems to work great now!
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.
If it's a static file, go with S3 static website (lifetime free 75GB with Scaleway) + Cloudflare.
'+x'?? I guess you meant 'go+r'?