Where are website files located for the Caddy containerized app?
I’ve looked in all of the folders in usb1/apps/caddy. However, I cannot find the index file.
In one of the apps/layers folders, I did find a folder for Caddy and found a nested folder with an index file.
In Winbox, the Container window shows Caddy’s root dir as /usb1/apps/caddy/caddy_root and the working directory as /srv. The root folder has only an /etc folder and I could not find /src anywhere.
I found a caddy config file that has the site’s directory at /usr/share/caddy. That folder is in the apps/layers/a0effe29ade(caddy stuff) folder. Seems odd that the site directory would be in the layers folder instead of the apps/caddy folder.
Just to add: it's very common to use caddy only as a reverse proxy, and that's why a "www" directory is not placed by default.
It's a totally fine web server, though. But if it's used as such, the root directory (usually per "virtualhost") is specified with the "root" directive.
and that's what you should edit to control Caddy Server.
While the default enables a web server on port 80, with file-server enabled... the problem is the default uses the path /usr/share/caddy as the web server directory. And that is not what's mapped by defaults in MikroTik's /app configuration, which uses /srv inside caddy, and apps/caddy/caddy-site in RouterOS files.
So you need to change the root in the Caddy file, using above edit command:
:80 {
# Set this path to your site's directory.
root * /srv
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
}
which will then make the RouterOS path to the www of Caddy server:
Well, the caddyfile syntax is already a really easy shorthand form, so adding an even more intuitive interface sounds like a bit too much. One, however, can always hope...