Precompressed files for WordPress

Did you figure it out? I am also trying to transition away from Nginx + Cache Enabler with Precompressed .gz which is the fastest setup for Wordpress.

See the docs for the file_server directive, where you can enable support for serving precompressed files.

Please don’t reply to old questions on wiki topics. Please open a new help topic. I moved your comment to a new topic.

Thanks @francislavoie

It is working now. I am posting the config below for further feedback. What do you think?

xyz.com {
    root * /var/www/html/xyz.com
    php_fastcgi unix//run/php/php8.2-fpm.sock
    file_server {
	precompressed gzip	
    }
    encode zstd gzip

    @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.gz /wp-content/cache/cache-enabler/{host}{uri}/index.html {path} {path}/index.php?{query}
    }	

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

    rewrite @disallowed '/index.php'
}

This topic was automatically closed after 29 days. New replies are no longer allowed.