• 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

Wordpress cache

Richie Tjin

New Pleskian
turned on caching (nginx) in Wordpress Toolkit and also have a plugin wordpress super cache. Can I use both?

If not, which one is better to turn on?
 
From my personal experience using nginx caching gives better performance in most cases.
But you can try to enable/disable one of them and check your site performance with gtmetrix.com for example and choose the better option.
 
turned on caching (nginx) in Wordpress Toolkit and also have a plugin wordpress super cache. Can I use both?

If not, which one is better to turn on?

@Richie Tjin

It makes no sense to have cache activated at the WordPress (read: Apache) level AND the Nginx (read: proxy) level.

@IgorG is right in stating that Nginx caching will perform better............. however, this requires some custom tweaking of Nginx caching settings on the domain level.

For instance, the average WP site is fully bloated with cookies and that can be a problem, causing Nginx cache being bypassed.

So, you should try some custom settings and changes to these settings, before going live with the Nginx caching mechanism.

In general, the following applies to Nginx caching:

- advantage: fast, reliable and memory efficient (read: caching on the Apache level is not........so any WordPress caching plugin is not fast, reliable and memory efficient)
- disadvantage: custom tweaking per site might be required
- potential challenge: reloading Nginx cache in memory might take some time, but that can be taken care of with proper Nginx configuration

Please note that the removal of WordPress caching plugins might be associated with various issues: these issues are often related to the fact that most of these plugins are not cleaning up properly, when being deactivated or removed. In most cases, a return to the original .htaccess file will be sufficient (read: this is the common culprit of issues).

Hope the above helps a bit.

Regards.........
 
@trialotto Let's talk about "proper Nginx configuration". Here is how I have set it up:
------------------------------------------------------------
Expires = 30d
Restrict the ability to follow = ON
Proxy mode = ON
Smart static files processing = ON
Serve static files directly by nginx =ON
Enable nginx caching = ON
Disable caching for locations ="/wp-admin/"
Bypass cache when = all 3 ON
Return stale cached records = all 3 OFF
Additional nginx directives:
# enable GZIP compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/html text/javascript text/plain text/xml;
# Security Headers - X-XSS-Protection
add_header x-xss-protection "1; mode=block" always;
# Security Headers - X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# Security Headers - X-Content-Type: nosniff
add_header X-Content-Type-Options nosniff;
# Security Headers - HTTP Strict Transport Security (HSTS)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
------------------------------------------------------------

And then nothing in the WP itself. Is this what you'd call proper? Or is anything to be optimized?
OLAF :)
 
@Olaf Kapinski

There are some things to improve in your Nginx configuration, but the general outline is (more than) fine.

To be honest, the optimal results can only be achieved by customizing the default Nginx templates, which are not really ideal for proper caching or optimization of Nginx.

I have mentioned this to Plesk Team and action will be taken, followed by some simple article/tutorial (as promised by me to Plesk Team).

In the meantime, feel free to send me a private message on the forum, so I can discuss your Nginx configuration in a more easy way: let's optimize for your specific situation.

Regards.........
 
I'm trying to make the Nginx caching work with Plesk.

I want Nignx to cache static pages of WordPress and then serve new visitors with those pages.

My TTFB is currently around 4-6 seconds and hoping to solve this with Nginx caching.

Has anyone been able to setup the cache successfully? I keep on getting a miss for the cache.

Thanks
Chris
 
@Chris Lemmer

In essence, there is some additional work to do in customizing the default Nginx templates, to make Nginx caching mechanism work properly.

In the meantime, you should have a look at the cookies stored when loading the pages : some of those cookies are causing cache misses.

Normally, one would not want or should not cache cookies, but some cookies are simply not changing (yes, I know - this is a terrible coding or design flaw).

You can add those cookies to the associated box in Plesk panel and Nginx will cache requests with those cookies (note : by default, requests with cookies are not cached).

Hope the above helps a (tiny) bit.

Regards.......
 
Is there an expert that can assist with this?

I'd love someone to help with the Nginx caching setup for WordPress and WooCommerce. There are also a few other plugins like Facebook remarketing, etc, that have cookies. All these could need to be taken into account.

Kind regards
Chris
 
@Olaf Kapinski

There are some things to improve in your Nginx configuration, but the general outline is (more than) fine.

To be honest, the optimal results can only be achieved by customizing the default Nginx templates, which are not really ideal for proper caching or optimization of Nginx.

I have mentioned this to Plesk Team and action will be taken, followed by some simple article/tutorial (as promised by me to Plesk Team).

In the meantime, feel free to send me a private message on the forum, so I can discuss your Nginx configuration in a more easy way: let's optimize for your specific situation.

Regards.........



Hello,

is there already and simple article / tutorial to setup the Nginx Config ? I have as well installed WP-Rocket do i also have to exclude /cache/ Folder in Disable caching for locations?

Thx
Sally
 
@trialotto Let's talk about "proper Nginx configuration". Here is how I have set it up:
------------------------------------------------------------
Expires = 30d
Restrict the ability to follow = ON
Proxy mode = ON
Smart static files processing = ON
Serve static files directly by nginx =ON
Enable nginx caching = ON
Disable caching for locations ="/wp-admin/"
Bypass cache when = all 3 ON
Return stale cached records = all 3 OFF
Additional nginx directives:
# enable GZIP compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf image/svg+xml image/x-icon text/css text/html text/javascript text/plain text/xml;
# Security Headers - X-XSS-Protection
add_header x-xss-protection "1; mode=block" always;
# Security Headers - X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# Security Headers - X-Content-Type: nosniff
add_header X-Content-Type-Options nosniff;
# Security Headers - HTTP Strict Transport Security (HSTS)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
------------------------------------------------------------

And then nothing in the WP itself. Is this what you'd call proper? Or is anything to be optimized?
OLAF :)

Do you have maybe an update on this one and where i can put this configuration? Thanks in advance!
 
Hi @ivapix
You have two options to put this in:
1) Directly in the domain under "apache & nginx-settings", field "additinal nginx-settings" (or so, my system is in german).
2) In the Service Packet, Tab Webserver, same Area.

Sadly the Service-Packets are not really reliable, so put it in each domain manually. You can see the results in gtmetrix.com
 
Hi @ivapix
You have two options to put this in:
1) Directly in the domain under "apache & nginx-settings", field "additinal nginx-settings" (or so, my system is in german).
2) In the Service Packet, Tab Webserver, same Area.

Sadly the Service-Packets are not really reliable, so put it in each domain manually. You can see the results in gtmetrix.com

Thank you for this! Really appreciate it. Have you tested this with Speed Kit extension also enabled?
 
Back
Top