1. The problem I’m having:
I am trying to use Caddy as my web server. The website root is at /var/www/myurl.com, in which I have files such as index.html, etc.
All these files are served just fine. However, I also wish to serve other static files from the /var/www/myurl.com/assets directory, but these are not found by Caddy.
If I do a simple mv /var/www/myurlcom/assets/some_file.txt /var/www/myurl.com/, then that file would also be served.
I have tried tinkering with permissions (as suggested by Understanding Permissions for the Caddy server ) and adding a manual handle directive (as suggested by V2: File Server Subdirectory with Listings ), but none of these suggestions worked.
Based on the documentation for file_server, it seems that all should work fine without much further configuration needed, but I am clearly missing something.
2. Error messages and/or full log output:
No explicit error messages, but I am not seeing the intended behaviou as described in the above section.
3. Caddy version:
v2.11.4 h1:XKxkMTgNSizEvKG6QHue6cAsFOteU2qA61w2tKkCWi0=
4. How I installed and ran Caddy:
I installed Caddy as a .deb package (as per Install — Caddy Documentation ) and am running it as a system service (i.e. sudo systemctl start caddy). Perhaps worth mentioning that it also happens if I run Caddy as via the CLI, i.e. caddy run --config /etc/caddy/Caddyfile.
a. System environment:
Ubuntu 24.04.4 LTS x86_64. Not running as Docker container.
b. Command:
sudo systemctl start caddy
… and after making changes to my Caddyfile, I run:
caddy reload --config /etc/caddy/Caddyfile
d. My complete Caddy config:
myurl.com {
root /var/www/myurl.com
file_server
}
(throughout this post, I have changed the actual domain name to myurl.com to stay anonymous)