I am simply trying to start a fileserver for literally ONE file that I can access anywhere.
I have no interest in using a domain name or anything fancy at this stage.
I have a linux (ubuntu) box where I have setup ufw firewall, have allowed ports 80 and 443 for web traffic.
2. Error messages and/or full log output:
I’m not sure at this point, do I need to use https or http , but either way, the site cannot be reached.
Have tried accessing via:
x.x.x.x:80
x.x.x.x
x.x.x.x/test/myfile.txt
x.x.x.x/myfile.txt
thank you, I am so new to this that some of the suggestions seem irrelevant or I don’t know what to do - the documentation doesn’t give examples of how I’m trying to make it work without a domain
I have gotten a little further I think by changing to port to 8080, opening that port in my firewall and doing
@matt Interesting, well I didn’t try the file-server command line option, thinking it won’t stay running ?
But indeed, that simple line you gave works, the file I’m trying to accessed is served fine, so I do wonder, what in the Caddyfile might be causing the issue.
Yes, you should put your files in /srv or /var/www.
The caddy user won’t have permission to read files in /home because the way Linux permissions work, every directory that is a parent to the target needs to have the executable bit set for the file to be visible to the user trying to access it. The /home directory does not have that bit set, because Linux hides which users exist on the system unless you have permission to see it.
When you run caddy file-server, you’re running Caddy as your own user, instead of the caddy user which is used when you run Caddy as a systemd service. That’s why it worked with that command.
I do recommend running as a service if you need to keep Caddy running long-term.