Jump to content

Caddy - a lightweight HTTP2 web server


gurkendoktor
 Share

Recommended Posts

  • 4 years later...

Hello wonderful Caddyphiles,

Do any of you have an updated config for PW and Caddy?  I wouldn't mind trying this out now Caddy has matured somewhat. Never run it before though so will start acquainting myself with the docs.

Link to comment
Share on other sites

Here is my Caddy 2 config for a PW site:
 

mysite.fi, www.mysite.fi {
    encode gzip
    tls my@email.com
    root * /var/www/mysite/pw
    file_server

    php_fastcgi unix//var/run/php-fpm/php-fpm.sock {
        health_timeout 10000s
    }

    @deny_hidden path_regexp /\.
    @deny_root path_regexp /(CONTRIBUTING|COPYRIGHT|LICENSE|README|htaccess)\.txt
    @deny_assets path_regexp ^/site(-[^/]+)?/assets/(.*\.php|backups|cache|config|install|logs|sessions)
    @deny_install path_regexp ^/site(-[^/]+)?/install
    @deny_config path_regexp ^/(site(-[^/]+)?|wire)/(config(-dev)?|index\.config)\.php
    @deny_modules path_regexp ^/((site(-[^/]+)?|wire)/modules|wire/core)/.*\.(inc|module|php|tpl)
    @deny_templates path_regexp ^/(site(-[^/]+)?|wire)/templates(-admin)?/.*\.(inc|html?|php|tpl)

    rewrite @deny_hidden /denyaccess
    rewrite @deny_root /denyaccess
    rewrite @deny_assets /denyaccess
    rewrite @deny_install /denyaccess
    rewrite @deny_config /denyaccess
    rewrite @deny_modules /denyaccess
    rewrite @deny_templates /denyaccess

    # global rule
    try_files {path} {path}/ /index.php?it={path}&{query}

    log {
        format single_field common_log
        output file /var/log/www/access.log {
            roll_size      50MiB
            roll_keep      5
            roll_keep_for  168h
        }
    }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...