I use Caddy v2 on my website and I have a link to a webapp that is located in a subfolder in my webpath (webroot/5g).
The index file in that subdirectory is a index.php file, but when I navigate to 5G Throughput Calculator, I get only the index.php to load correctly, but not the assets with it. When I visit 5G Throughput Calculator, it loads the assets just fine.
How do I need to setup my Caddyfile v2 to achieve this?
Caddyfile:
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"hnrk.io",
"www.hnrk.io"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "vars",
"root": "/etc/caddy/html"
},
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"encodings": {
"brotli": {},
"gzip": {},
"zstd": {}
},
"handler": "encode"
}
]
},
{
"handle": [
{
"handler": "rewrite",
"rehandle": true,
"uri": "{http.matchers.file.relative}{http.request.uri.query_string}"
}
],
"match": [
{
"file": {
"try_files": [
"{http.request.uri.path}",
"{http.request.uri.path}/index.php"
]
}
}
]
},
{
"handle": [
{
"handler": "reverse_proxy",
"transport": {
"protocol": "fastcgi",
"split_path": ".php"
},
"upstreams": [
{
"dial": "unix//run/php/php7.3-fpm.sock"
}
]
}
],
"match": [
{
"path": [
"*.php"
]
}
]
},
{
"handle": [
{
"handler": "file_server",
"hide": [
"Caddyfile"
]
}
]
}
]
}
]
}
]
}
]
}
],
"experimental_http3": true
}
}
},
"tls": {
"certificates": {
"load_files": [
{
"certificate": "/etc/caddy/hnrk.io.crt",
"key": "/etc/caddy/hnrk.io.key"
}
]
},
"automation": {},
"session_tickets": {}
}
}
}
Thanks!