I’m running Caddy 2.2.0 on Arch Linux with systemd. I am happy to have successfully converted my config for Processwire CMS and KiwiBNC IRC bouncer. I have a teensy bit of trouble with my Webtrees config.
I need to serve assets residing in the /public directory, of the form /public/css/vendor.min.css?v=2.0.4
It is obvious my rewrite for /public is not working. Help appreciated!
Caddyfile v1:
webtrees.mysite.fi {
gzip
root /var/www/mysite/webtrees
fastcgi /index.php unix:/var/run/php-fpm/php-fpm.sock php {
connect_timeout 10000s
read_timeout 10000s
send_timeout 10000s
}
internal /forbidden
rewrite {
r ^/data
to /forbidden
}
rewrite {
r ^/.git
to /forbidden
}
rewrite {
r ^/app
to /forbidden
}
rewrite {
r ^/modules
to /forbidden
}
rewrite {
r ^/resources
to /forbidden
}
rewrite {
r ^/vendor
to /forbidden
}
rewrite {
r ^/public
to {path}
}
#pretty urls
rewrite {
r ^
to /index.php
}
}
Caddyfile v2:
webtrees.mysite.fi {
encode gzip
root * /var/www/mysite/webtrees
file_server
php_fastcgi /index.php unix//var/run/php-fpm/php-fpm.sock {
health_timeout 10000s
}
@deny path_regexp ^/(.git|data|app|modules|resources|vendor)
@prettyurls path_regexp ^
@public path_regexp ^/public
rewrite @deny /denyaccess
rewrite @prettyurls /index.php
rewrite @public {path}
}