Title: NGINX Rules
Last modified: July 30, 2026

---

# NGINX Rules

 *  Resolved [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [2 weeks, 1 day ago](https://wordpress.org/support/topic/nginx-rules-4/)
 * I was working on setting up NGINX rules for the plugin
   These are what I came 
   up with, although people may have better versions:In server:
 *     ```wp-block-code
       set $eo_base /wp-content/cache/easyopt/$host$uri;set $eo_br_file "";set $eo_gz_file "";set $eo_ok 1;if ($request_method != GET) { set $eo_ok 0; }if ($args != "") { set $eo_ok 0; }if ($eo_skip) { set $eo_ok 0; }if ($request_uri ~* "(/wp-admin|/wp-login|/wp-json|/feed/|/cart|/checkout|/my-account|/wc-api|.xml$|.txt$)") { set $eo_ok 0; }if ($eo_ok) { set $eo_gz_file "${eo_base}/index${eo_mobile}.html_gzip"; }if ($eo_ok) { set $eo_br_file "${eo_base}/index${eo_mobile}.html_br"; }if ($eo_br = 0) { set $eo_br_file ""; }location / {if (-f "$document_root$eo_br_file") { rewrite ^ $eo_br_file last; }if (-f "$document_root$eo_gz_file") { rewrite ^ $eo_gz_file last; }try_files $uri $uri/ /index.php?$args;}location /wp-content/cache/easyopt/ { internal; }location ~ /wp-content/cache/easyopt/..html_br$ { internal; add_header Content-Type "text/html; charset=UTF-8"; add_header Content-Encoding br; add_header Vary Accept-Encoding; add_header X-Easy-Optimizer-Cache "HIT-nginx"; add_header Cache-Control "no-cache, must-revalidate"; add_header CDN-Cache-Control "max-age=2592000, stale-while-revalidate=86400, stale-if-error=86400"; } location ~ /wp-content/cache/easyopt/..html_gzip$ {internal;add_header Content-Type "text/html; charset=UTF-8";add_header Content-Encoding gzip;add_header Vary Accept-Encoding;add_header X-Easy-Optimizer-Cache "HIT-nginx";add_header Cache-Control "no-cache, must-revalidate";add_header CDN-Cache-Control "max-age=2592000, stale-while-revalidate=86400, stale-if-error=86400";}
       ```
   
 * in http
 *     ```wp-block-code
       map $http_cookie $eo_skip {    default 0;    "~*(easyopt_skip_cache|wordpress_logged_in_|wordpress_sec_|comment_author_|wp-postpass_|woocommerce_items_in_cart|wp_woocommerce_session_|edd_items_in_cart)" 1;}# Only needed if "Separate mobile cache" is ON. Omit it and phones get desktop pages.map $http_user_agent $eo_mobile {    default "";    "~*(android.+mobile|blackberry|iemobile|ip(hone|od)|kindle|maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino)" "-mobile";}map $http_accept_encoding $eo_br { default 0; "~*(^|,)\s*br\s*(,|$)" 1; }
       ```
   
 * If this can be helpful to some people, all the better. Loving the plugin, and
   want to see it do well!
    -  This topic was modified 2 weeks, 1 day ago by [raven747](https://wordpress.org/support/users/raven747/).

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Uzair](https://wordpress.org/support/users/uzairwp/)
 * (@uzairwp)
 * [1 week, 5 days ago](https://wordpress.org/support/topic/nginx-rules-4/#post-18981685)
 * we already have nginx rules in **caching > Advanced: optional Nginx server rules**
   
   please test it and let us know if any issue.

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fnginx-rules-4%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/easy-optimizer/assets/icon-256x256.gif?rev=3545305)
 * [Easy Optimizer – PageSpeed, Cache & Core Web Vitals (Unused CSS, Delay JS, Lazy Load)](https://wordpress.org/plugins/easy-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-optimizer/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Uzair](https://wordpress.org/support/users/uzairwp/)
 * Last activity: [1 week, 5 days ago](https://wordpress.org/support/topic/nginx-rules-4/#post-18981685)
 * Status: resolved