PHP opcode cache and Nginx fastcgi_cache can be used together. They serve different purpose.
We use W3 Total Cache’s mysql and object cache with PHP’s APC storage.
Page-caching is turned off in W3 Total Cache. We use Nginx’s fastcgi_cache for page cache.
You will need nginx-helper if you are using fastcgi_cache. You will also need to install/compile nginx with nginx-cache-purge module. This is covered in this article – https://rtcamp.com/tutorials/nginx-wordpress-fastcgi_cache-with-conditional-purging/
As far as Varnish is concerned we do not use or recommend it with Nginx. Varnish is good when used with Apache. With Nginx, its not worth extra time we spend on it.
By the way, I forgot to add:
My website is working fine with this settings
If all is working nicely, its better to stick with it 🙂
If it ain’t broke, don’t fix it!
Hi, firstly, thank you very much for the fast reply!
If all is working nicely, its better to stick with it 🙂
If it ain’t broke, don’t fix it!
Haha, really? It’s working fine, as I said, but performance isn’t really as great as it could be, you understand? I liked what you said about Varnish, as it doesn’t seems to make any great performance improvements and is using a lot of CPU/RAM.
I will just stop using Varnish in order to compile nginx with fastcgi_cache and use nginx-helper.
So, to clarify things, the best settings may be:
1) Disable Varnish, because as I said before, the performance gains with Varnish enabled is really low.
2) Keep using W3TC to Mysql/object cache only? And what about page cache and browser cache, both must be disabled?
3) Configure fastcgi_cache with nginx-helper just like your tutorial?
That’s just it?
It will be better if you try – https://rtcamp.com/tutorials/wordpress-nginx-w3-total-cache/
For page-caching, Nginx’s fastcgi_cache and W3 Total Cache do not differ much in performance. But it much more easier to use w3 total cache.
You can still use Nginx Helper to remove index.php from permalinks.
That being said, I use Nginx’s fastcgi_cache for some other reasons:
- It “feels” faster.
- I keep playing with server, so many times I need to deactivate w3 total cache. In-such cases where I forgot to reactivate it, nginx’s fastcgi_cache still keeps doing its job.
- If any plugin is not playing nice with w3-total-cache, I can deactivate w3-total-cache.
- W3-total-cache do not have multisite support (its in beta). On multisite Nginx’s fastcgi_cache is much easy to setup. Add few lines in nginx and all current, future sites in multisite will atleast have page-cache
- For other plugin like woocommerce, I prefer editing nginx-config rather than figuring out caching-plugin settings to control caching mechanisim
Please note, its hard to decide for once which is faster among Nginx fastcgi_cache, w3-total-cache or even wp-super-cache. Choose one which is more comfortable and does the job.
In any case use an op-code cache, a page-cache and object/mysql-cache for best performance. Always have browser cache (configure it from Nginx).
Thanks again! I will try exactly as you said. In the post you have written, you ask to disable Browser Cache, that’s because nginx do this work? As your post doesn’t shows how the “http {” must be configured, just shows the “server {“, I will paste here how I have configured gzip in nginx, is it okay or may I also change something?
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
gzip on;
gzip_static on;
gzip_comp_level 4;
gzip_min_length 1024;
keepalive_timeout 65;
limit_zone myzone $binary_remote_addr 10m;
client_max_body_size 10M;
I am not able to recall clearly but Nginx repo I use comes with gzip on always in config.
I will recheck it on next setup.
By the way – I use http://www.whatsmyip.org/http-compression-test/ to test if gzip is enabled.
Other things I look for are – https://rtcamp.com/tutorials/checklist-for-perfect-wordpress-nginx-setup/
Okay! I just like to say thank you for all the attention! I liked all your posts and your plugin! 😉
My pleasure. Glad to know that. 🙂
I will be revamping all nginx tutorials later this month. Sort of version 2.0.
As of now sometimes they become hard to navigate….