1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
a. System environment:
Windows 11 Pro (22H2)
b. Command:
caddy run --watch
c. Service/unit/compose file:
caddy run --watch
d. My complete Caddy config:
{
storage file_system .\caddy
}
(php_filebrowser) {
# Add trailing slash for directory requests
@canonicalPath {
file {path}/index.php
not path */
}
redir @canonicalPath {path}/ 308
# If the requested file does not exist, try index files
@indexFiles file {
try_files {path}/index.php {path}/index.html
}
rewrite @indexFiles {http.matchers.file.relative}
# Proxy PHP files to the FastCGI responder
@phpFiles path *.php
reverse_proxy @phpFiles localhost:9000 {
transport fastcgi {
split .php
}
}
file_server browse
}
localhost, 127.0.0.1 {
log {
output file .\log\caddy.log
format console
}
route /www/* {
root .\www
}
route /gh/* {
root C:\Projects
}
import php_filebrowser
}
3. The problem I’m having:
I’m trying to have two endpoints, each with a different root directory. Both should be routed like the “php_filebrowser” snippet. Localhost returns the php_filebrowser with the root directory of caddy (where the binary is). “localhost/www”, “localhost/www/” and “localhost/www/*” return a 404 error. Same with the “gh” endpoint.
4. Error messages and/or full log output:
$ caddy validate
2022/10/28 23:56:13.552 INFO using adjacent Caddyfile
2022/10/28 23:56:13.553 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2022/10/28 23:56:13.554 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2022/10/28 23:56:13.554 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2022/10/28 23:56:13.554 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00077f960"}
2022/10/28 23:56:13.555 INFO tls.cache.maintenance stopped background certificate maintenance {"cache": "0xc00077f960"}
Valid configuration
5. What I already tried:
Tried different variations but couldn’t get it running as it should.
6. Links to relevant resources:
/