• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Nginx cache - not creating any cache

ChickenDipper

New Pleskian
Server operating system version
CentOS Linux 7.9.2009 (Core)
Plesk version and microupdate number
Plesk Obsidian v18.0.44_build1800220608.16 os_CentOS 7
Hello,

I have turned up nginx cache on my Wordpress website in Plesk but it will not create any cache files at all.

Oddly if I enable a third party cache plugin within Wordpress at the same time as Nginx cache, Nginx cache will grab a cached version of the homepage only if I am lucky but that is it. I would rather turn off any third party plugins and use jsut Nginx cache, but I need it to cache all pages in my website.

Here is the setup:
1655111531033.png


Please if anyone can help me with this it would be much appreciated.

Thank you.
 
To add to this.

I just setup a dummy wordpress site under a spare domain, enabled nginx cache and it works totally fine. I can see the files generated in the cache folder instantly.
 
Make sure you list ALL cookies in the 'Cache requests with cookies' field. You can use your browsers developer console for look for cookies that are placed by your website. With the developer console you can also look at the X-Cache-Status header returned, which gives an indication for if and why caching didn't work.

Also note that a 2 GB cache size is extremely high and a cache timeout of 30 days is extremely long. Although these high values aren't necessary wrong, they are unusual. Cache size is usually a few MB to a few hundred MB. Timeout is usually a couple of minutes to till about hour.
 
Hi,

Thanks I tried this, but it has made no change.

I have found something interesting, the nginx cache will only be created while I am using a cache plugin such as w3 total cache. I have to visit a page so it is cached by w3 then refresh and it will appear in the nginx cache.

This is not correct though, nginx should be able to cache the pages itself without a plugin "pre caching" the files first so nginx makes a copy?

I wouldn't usually set these limits so high, but while testing I have been trying anything I can :)
 
So what does the X-Cache-Status header return?

Nginx cache should work without any pre-cache or additional caching plugin. If it doesn't there is something on you site that prevents nginx from caching.
 
You are a life saver.

I found this:
  • Set-Cookie: cntctfrm_send_mail=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0
Which is the cause all along, thank you so much for your help. It is working as expected now :)

Edit: Although adding cntctfrm_send_mail cookie to Cache requests with cookies doesn't seem to work.

I am assuming I should enter it into the field as: _cntctfrm_send_mail
 
Update...

I have tried entering the cookie into the Cache requests with cookies field as follows:

cntctfrm_send_mail
_cntctfrm_send_mail
cntctfrm_send_mail=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0

But no matter how it is entered it is still stopping caching, any advice on this?

Thanks again.
 
I have resolved this by removing the cookie from the plugin for now.

I do have a question about the way the cache is working though, if I watch the size of the cache I can see that it is growing then shrinking in size over random amounts of time depending on requests to the server.

This is happening without me deleting or clearing the cache myself. Any idea why the cache would shrink at all? The nginx cache is set to 5 days so would not have expired already.

Thanks
 
I have resolved this by removing the cookie from the plugin for now.

I do have a question about the way the cache is working though, if I watch the size of the cache I can see that it is growing then shrinking in size over random amounts of time depending on requests to the server.

This is happening without me deleting or clearing the cache myself. Any idea why the cache would shrink at all? The nginx cache is set to 5 days so would not have expired already.

Thanks

Is there anyone that can tell me why this is happening?
Even if the cache was expiring the files would remain until someone accesses that page which would then update the stale cache file.
So I cannot work out why the cache size would drop and cached files vanish too?
 
Back
Top