1. My Caddy version (caddy version
):
v2.0.0-rc.3 h1:z2H/QnaRscip6aZJxwTbghu3zhC88Vo8l/K57WUce4Q=
2. How I run Caddy:
Caddy has been installed on Ubuntu using the repo’s:
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
| sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy
a. System environment:
- Ubuntu 20.04
- Caddy is installed as a service using the repo
- PHP-FPM 7.4.5
b. Command:
systemctl start caddy
c. Service/unit/compose file:
/etc/caddy/Caddyfile
test.ke.vinpet.it, www.test.ke.vinpet.it {
root * /var/www/test.ke.vinpet.it/website/public
encode zstd gzip
file_server
}
staging.guildwarslegacy.com, www.staging.guildwarslegacy.com {
root * /var/www/staging.guildwarslegacy.com/public_html
php_fastcgi unix//run/php/php7.4-fpm-gwl_staging.sock
@woltlab {
path_regexp woltlab ^/index.php/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$
}
rewrite @woltlab /index.php/{http.regexp.woltlab.1}
encode zstd gzip
file_server
log {
output file /var/log/caddy/access.log
}
}
3. The problem I’m having:
I’m trying to rewrite the Woltlab nginx rewrite rules to something that Caddy understands.
These rewrite rules look like:
location / {
index index.php;
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$ /$1index.php?$2 last;
}
If I am correct, Caddy handles the try files with php_fastcgi.
Currently, it just loads the homepage over and over again, not a single link works.
4. Error messages and/or full log output:
I don’t get any errors and all log output simply gives the homapage.
5. What I already tried:
At first, I tried this approach:
# rewrite /forum/* forum/index.php?{query}{path}
# rewrite /cms/* cms/index.php?{path}
# rewrite /wcf/* wcf/index.php?{path}
# rewrite /calender/* calendar/index.php?{path}
# rewrite /filebase/* filebase/index.php?{path}
# rewrite /blog/* blog/index.php?{path}
# rewrite /gallery/* gallery/index.php?{path}
I switched out path and query at one point, that also did not work.
After some research, I tried this:
@woltlab {
path_regexp woltlab ^/index.php/(forum/|cms/|wcf/|calendar/|filebase/|blog/|gallery/)?([^.]+)$
}
rewrite @woltlab /index.php/{http.regexp.woltlab.1}
However, it still didn’t work. I have no further idea how to fix this, though I’m still searching for more information online.
6. Links to relevant resources:
The website with issues is located at https://staging.guildwarslegacy.com
Thanks for taking a look at this!
Kevin