Caddy config examples

From UVOO Tech Wiki
Revision as of 14:25, 23 January 2023 by Busk (talk | contribs) (Created page with "``` { http_port 8080 https_port 8443 } # http://domain.com:8080 { http://testlocal.uvoo.io:8080 { # Change the path here according to your setup...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
{
        http_port 8080
        https_port 8443
}

# http://domain.com:8080 {
http://testlocal.uvoo.io:8080 {
        # Change the path here according to your setup
        # root * /var/www/domain.com
        # root * /home/busk/caddy/domains/localtest.uvoo.io
        root * ./domains/testlocal.uvoo.io
        encode zstd gzip
        file_server

        @cache {
                not header_regexp Cookie "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in"
                not path_regexp "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)"
                not method POST
                not expression {query} != ''
        }

        route @cache {
                try_files /wp-content/cache/cache-enabler/{host}{uri}/https-index.html /wp-content/cache/cache-enabler/{host}{uri}/index.html {path} {path}/index.php?{query}
        }

        # Change the path here according to your server
        php_fastcgi unix//run/php/php7.4-fpm.sock
}

http://testlocal1.uvoo.io:8080 {
        root * ./domains/testlocal1.uvoo.io
        encode zstd gzip
        file_server
        log {
                output file ./logs/testlocal1.uvoo.io.8080-access.log
        }
}

https://testlocal2.uvoo.io:8443 {
        root * ./domains/testlocal2.uvoo.io
        encode zstd gzip
        file_server
        tls ./certs/selfsigned.crt ./certs/selfsigned.key
        log {
                output file ./logs/testlocal2.uvoo.io.8443-access.log
        }
}