How to optimize WordPress for best performance – part2 ?

In previous post i’ve shared simple Nginx configuration with proxy_pass_cache. Such configuration looks good for static pages and rare changed content with manual cache purge. But what if you have quite active blog with frequent updates.

There is no problem with caching on Nginx side, but in case of changes in content – cache should be flushed somehow. That’s why we need some Nginx cache helper that will provide ability of cache flushing. One of the most popular extension is: Nginx helper by rtCamp.

This extension works with fastcgi_cache, so some changes in Nginx configuration file. You can follow original instruction or use those provided templates:

As you can see, now Nginx is running under system user apache. I need it, because don’t want to compile Nginx with 3-rd party extension for or install Nginx plus with proxy and fastcgi cache purge, so purge of cache conducted by removing files from file system.

WordPress settings of Nginx helper:

As you can see we need to define fastcgi_cache root path and enable fastcgi_cache. You can use such template for virtual host:

And define Nginx define('RT_WP_NGINX_HELPER_CACHE_PATH','/run/nginx/cache/'); in wp-config.php. Now you’re able to test. Good point to create test post and check that changes were provided on the frontend.

Additional help could provide you Nginx helper logging file.



Author: GergunD

Leave a Reply