Change WordPress Cache

Note: This article is applicable for site created with EasyEngine 1.x.
For sites created with EasyEngine 2.x use this

Basic (–basic) to FastCGI (–wpfc)

ee site edit example.com

Change following settings:

Old value:

# WPSINGLE BASIC NGINX CONFIGURATION
    

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

ADVERTISEMENT
    location ~ \.php$ {         try_files $uri =404;         include fastcgi_params;         fastcgi_pass php;     }

New value:

# WPSINGLE FAST CGI NGINX CONFIGURATION
include common/wpfc.conf;

Your new configuration look like this

Install Plugins:

  1. Nginx Helper
  2. W3 Total Cache

How to configure above plugin: Click Here

Super Cache (–wpsc) to FastCGI (–wpfc)

ee site edit example.com

Change following settings:

Old value:

# WPSINGLE WP SUPER CACHE NGINX CONFIGURATION

    set $cache_uri $request_uri;

ADVERTISEMENT
    # POST Requests And Urls With A Query String Should Always Go To PHP     if ($request_method = POST) {         set $cache_uri 'null cache';     }     if ($query_string != "") {         set $cache_uri 'null cache';     }     # Don't Cache Uris Containing The Following Segments     if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {         set $cache_uri 'null cache';     }     # Don't Use The Cache For Logged In Users Or Recent Commenters     if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {         set $cache_uri 'null cache';     }     # Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress     location / {         try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php;     }
ADVERTISEMENT
    location ~ \.php$ {         try_files $uri =404;         include fastcgi_params;         fastcgi_pass php;     }

New value:

# WPSINGLE FAST CGI NGINX CONFIGURATION
include common/wpfc.conf;

Your new configuration look like this

Install Plugins:

  1. Nginx Helper
  2. W3 Total Cache

How to configure above plugin: Click Here

W3 Total Cache (–w3tc) to FastCGI (–wpfc)

ee site edit example.com

Change following settings:

Old value:

# WPSINGLE W3 TOTAL CACHE NGINX CONFIGURATION
	set $cache_uri $request_uri;

	# POST Requests And Urls With A Query String Should Always Go To PHP
	if ($request_method = POST) {
		set $cache_uri 'null cache';
	}

	if ($query_string != "") {
		set $cache_uri 'null cache';
	}

ADVERTISEMENT
# Don't Cache Uris Containing The Following Segments if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { set $cache_uri 'null cache'; } # Don't Use The Cache For Logged In Users Or Recent Commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { set $cache_uri 'null cache'; } # Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress location / { try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args; } location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; } location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass php; }

New value:

# WPSINGLE FAST CGI NGINX CONFIGURATION
include common/wpfc.conf;

Your new configuration look like this

Install Plugins:

  1. Nginx Helper
  2. W3 Total Cache

How to configure above plugin : Click Here

Leave a Reply