If you are using WordPress or any other CMS on a web server that is using NGINX Caching, you may need to clear the cache at times.
Nginx, by default, don’t cache your HTML pages and CSS and JS files.
However, if you enable the caching using Fast CGI, then it can cache files and serve them faster from the cache rather than sending the request to the PHP compiler to generate the files.
I have been using the NGINX web server for more than two years and have even tried to use the Fast CGI cache.
Here is a simple directive you can add to your sites-available file (domain.com.conf) to use the Fast CGI Cache.
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=Wordpress:100m inactive=60m;fastcgi_cache_key "$scheme$request_method$host$request_uri";
When you change the appearance of your website, the Fast CGI cache doesn’t clean the cache.
The end visitor keeps getting the cached copy of the webpages.
There is a simple command that you can run in putty or terminal clear this cache.
Suppose your cache folder is present in etc/Nginx/cache.
You can run the Command rm – rf /etc/Nginx/Cache/*
sometimes the cache can be in the Var folder
rm – rf /var/Nginx/Cache/*
This command will delete all the contents in the cache folder.
Don’t worry, nothing wrong will happen.
Moreover, Nginx will regenerate all the files in a few minutes.
However, if you are looking to clear the NGINX Fast CGI cache from the WordPress dashboard, it is not possible using this method.
You can try some plugin to make it work by setting the path to your cache folder.
I even tried some of the plugins, but they haven’t worked as intended.
Also, there is not too much of a speed difference when using Fast CGI or Super Cache or W3 Total Cache.
I would recommend using a WordPress plugin based caching solution to have more easy access for clearing cache.
- How to Recover Website from Google Search Traffic Loss
- Fix: WordPress Update and Plugins Not Installing or Updating
- Master These 10 Skills To Create An Incredibly Successful Blog