1. Caddy version (caddy version
):
v2.4.5 h1:P1mRs6V2cMcagSPn+NWpD+OEYUYLIf6ecOa48cFGeUg=
2. How I run Caddy:
Using systemctl / systemd
a. System environment:
Ubuntu 18.04 (LTS) x64
b. Command:
reload the service ->
sudo systemctl daemon-reload
install the service ->
sudo sh -c 'curl https://raw.githubusercontent.com/caddyserver/dist/master/init/caddy.service > /etc/systemd/system/caddy.service'
c. Service/unit/compose file:
n/a
d. My complete Caddyfile or JSON config:
testing-twp.haula.net {
log {
level DEBUG
output file /var/log/caddy/access.log {
roll_size 10MiB
roll_keep 10
roll_keep_for 336h
}
}
handle_path /api* {
reverse_proxy localhost:3004
#log {
# level DEBUG
# output file /caddy/access.log {
# roll_size 10MiB
# roll_keep 10
# roll_keep_for 336h
# }
#}
# log stdout
# errors stdout
}
handle {
root * /var/www/html/test
encode gzip
try_files {path} /index.html
file_server
}
}
3. The problem I’m having:
I am trying to figure out how to host images out of a specific folder. I don’t want to browse that folder, simply host specific images for things like sticking into an email. So I want the url to be something like mysite.com/img/myimage.jpg
And hosted out of the folder /var/www/img
.
4. Error messages and/or full log output:
n/a
5. What I already tried:
I have read through the file_server docs here: file_server (Caddyfile directive) — Caddy Documentation and I couldn’t figure how to give both the url and the folder.