Pages not cached on Plesk Onyx, or NGINX servers

In some NGINX and Plesk Onyx environments, you might notice that the front page of your website is cached by WP Rocket, but the internal pages are not. This can be related to your server setup. 

Why is this happening? 

If you are using  Plesk Onyx's suggested configuration file, the one they recommend to use with WordPress in order to enable permalinks, their configuration also adds variables to the $_GET array. The GET array is the one the server creates when query strings like are used in the URLs. 

The same issue can take place for any NGINX server that is using a similar configuration.

When query strings are present, WP Rocket does not cache those pages by default. This happens, for example, when you access:

In this case, the cache works for the home page because the $_GET array is empty. but when visiting an internal page, the page slug is added to the $_GET array, disabling the cache. 

How to fix this? 

The solution is to change the config file.
If you are using Plesk Onyx's suggested configuration for WordPress, you should see something like this:

if (!-e $request_filename) {
	set $test P;
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
	set $test "${test}C";

if ($test = PC) {
	rewrite ^/(.*)$ /index.php?$1;

Please change it as follows, and test again:

if (!-e $request_filename){
	rewrite ^(.*)$ /index.php break;

If you are not familiar with this kind of configuration, or in case you need assistance, please consult with Plesk support before implementing this.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.