By default, FlyingPress serves cached pages through PHP on Nginx servers. However, you can configure Nginx to serve cached .html.gz
files directly from the file system—bypassing PHP entirely.
This can slightly improve performance, particularly for high-traffic sites.
When to use this
Optional for most sites
Recommended only if you're comfortable with Nginx configuration
Performance gain is minor for most, but can reduce PHP usage under load
Nginx configuration
Add the following block to your site’s Nginx config:
location ~* \.html\.gz$ {
gzip off;
brotli off;
add_header x-flying-press-cache HIT;
add_header x-flying-press-source "Web Server";
add_header cache-control "no-cache, must-revalidate, max-age=0";
add_header CDN-Cache-Control "max-age=2592000";
add_header Cache-Tag $host;
add_header Content-Encoding gzip;
add_header Content-Type "text/html; charset=UTF-8";
}
set $flying_press_cache 1;
set $flying_press_url "/wp-content/cache/flying-press/$http_host/$request_uri/index.html.gz";
set $flying_press_file "$document_root/wp-content/cache/flying-press/$http_host/$request_uri/index.html.gz";
if ($request_method = POST) {
set $flying_press_cache 0;
}
if ($is_args) {
set $flying_press_cache 0;
}
if ($http_cookie ~* "(wp\-postpass|wordpress_logged_in|comment_author|woocommerce_cart_hash|edd_items_in_cart)") {
set $flying_press_cache 0;
}
if (!-f "$flying_press_file") {
set $flying_press_cache 0;
}
if ($flying_press_cache = 1) {
rewrite .* "$flying_press_url" last;
}
Notes
This serves pre-compressed HTML files directly from the filesystem
Applies only to GET requests with no query strings and no login/cart cookies
Make sure
.html.gz
files are generated by FlyingPress and Gzip is supportedAlways test on staging before applying in production