Caddyfile
author ymh <ymh.work@gmail.com>
Tue, 27 Sep 2022 16:37:53 +0200
changeset 19 3d72ae0968f4
child 21 48c4eec2b7e6
permissions -rw-r--r--
upgrade wordpress to 6.0.2

{
       auto_https off
       debug
       admin off
#         log {
#                 level DEBUG
#                 output stdout
#         }
}

# enmi-conf.local {
        # root * /usr/share/caddy

#        php_fastcgi /wp/* fpm:9000 {
#                root /usr/share/caddy
#        }
    # file_server
        # file_server
# }

http://enmi-conf.local:8080 {
    root * /var/www/html
    header -Server

    @site_staticfiles {
        path_regexp site_files ^/wp/([^/]+)?(/wp-.*)
    }

    rewrite @site_staticfiles /wp{re.site_files.2}

    # rewrite {
    #   regexp ^(/[^/]+)?(/wp-.*)
    #   to {2}
    # }

    # rewrite {
    #   regexp ^(/[^/]+)?(/.*\.php)
    #   to {2}
    # }

    # rewrite {
    #   if {path} not_match ^\/wp-admin
    #   to {path} {path}/ /index.php?{query}
    # }
    try_files {path} {path}/index.php /wp/index.php

    php_fastcgi fpm:9000 {
        index off
    }

    file_server
    
    encode gzip


    @disallowed {
        path /wp/xmlrpc.php
        path *.sql
        path /wp/wp-content/uploads/*.php
    }

    rewrite @disallowed '/wp/index.php'

}