Roman Soldatow · Developer Blog
It’s been a while since I started using caddy v2 in production. Therefore I would like to show some caddy configuration examples that I also use by myself.
HTTP3 in Caddy v2In the last caddy post I mentioned how to setup HTTP3, however the syntax has changed slightly.
1 2 3 4 5 6 7 { servers :443 { protocol { experimental_http3 } } }
Reverse proxySimple reverse proxy (to a specific port)
1 2 3 matrix.rmsol.de { reverse_proxy localhost:8008 }
File serverServing a static page (html/css). In that case with gzip and extended Cache-Control .
1 2 3 4 5 6 rmsol.de { root * /var/www/rmsol.de encode gzip header Cache-Control max=age=3600 file_server }
PHP websiteServing a PHP website.
1 2 3 4 5 ip-whois.de { root * /var/www/ip-whois.de file_server php_fastcgi unix//var/run/php/php7.4-fpm.sock }
Nextcloud1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 nextcloud.rmsol.de { root * /var/www/nc file_server php_fastcgi unix//var/run/php/php7.4-fpm.sock header { Strict-Transport-Security max-age=31536000; # enable HSTS } redir /.well-known/carddav /remote.php/dav 301 redir /.well-known/caldav /remote.php/dav 301 @forbidden { path /.htaccess path /data/* path /config/* path /db_structure path /.xml path /README path /3rdparty/* path /lib/* path /templates/* path /occ path /console.php } respond @forbidden 404 }
Read the original on rmsol.de ↗
← Posts Newer Older Open ↗ ✦ Next blog
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.