Caddyfile
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:52:52 +0200
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
permissions -rw-r--r--
Update WordPress to latest version (6.7) - Sync WordPress core files from latest release - Updated admin interface, blocks, and core functionality - Enhanced block editor features and performance - Security updates and bug fixes - Preserved custom wp-content directory and configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>

{
       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.127.0.0.1.nip.io: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'

}