What caching plugin configuration do you recommend and why under the following assumptions:
- full control of the server configuration
- running WordPress in multi-site/multi-domain mode
- most domains are not using
www.
prefix (cookies) - (desire) to be able to disable caching for specific IPs or based on a cookie, when you do changes to the site you don’t need caching.
Details: I’m using Firefox Google Page Speed plugin to try to optimize the speed of the website.
Also please do not guide with generic guidelines, like smaller images.
Let’s be fair, using more than one caching plugin will bring you more problems than it will solve so please try to give a simple approach.
Basic answer to “what plugin” would probably be W3 Total Cache. It is one of the most functional and actively developed plugins at moment. However complete performance chain is much longer that WordPress plugin alone can handle.
Good start would be static caching plugin (like W3) with opcode memory-based cache like APC.
But from there there are way more (and way more complex) things you could do, like content distribution networks, alternate web servers, etc.
My WordPress Performance and Caching Stack
This is the best WordPress performance stack for a low to mid range single server or VPS. I am classifying mid range as single core with around 1G of memory and fairly fast drives.
Server Stack
PHP Cache
WordPress Performance Plugin Stack
With W3 Total Cache we are using disk for page cache and minify because Nginx will be serving our static files very fast.
How to configure Nginx to serve static files and pass PHP to Apache
The problem with using Apache alone is that it opens up a connection and hits php on every request even for static files. This wastes connections because Apache will keep them open and when you have lots of traffic your connections will be bogged down even if they are not being used.
By default Apache listens for requests on port 80 which is the default web port. First we are going to make changes to our Apache conf and virtual hosts files to listen on port 8080.
Apache Config
httpd.conf
set KeepAlive to off
ports.conf
Per Site Virtual Host
You should also install mod_rpaf so your logs will contain the real ip addresses of your visitors. If not your logs will have 127.0.0.1 as the originating ip address.
Nginx Config
On Debian you can use the repositories to install but they only contain version 0.6.33. To install a later version you have to add the lenny backports packages
$ nano /etc/apt/sources.list
Add this line to the file
deb http://www.backports.org/debian lenny-backports main
$ nano /etc/apt/preferences
Add the following to the file:
Issue the following commands to import the key from backports.org to verify packages and update your system’s package database:
Now install with apt-get
apt-get install nginx
This is much easier than compiling from source.
Nginx conf and server files config
nginx.conf
Now you will need to set up your Nginx virtual hosting. I like to use the sites-enabled method with each v host sym linked to a file in the sites-available directory.
default.conf
Note:
The static cache settings in the following files will only work if the Nginx proxy cache integrator plugin is enabled.
Per WordPress site conf (For multi site you will only need one vhost)
Self Hosted CDN conf
For your self hosted CDN conf you only need to set it up to serve static files without the proxy pass
Now start the servers
The Benchmark Results
On Apache Bench this setup can theoretically serve 1833.56 requests per second
Use a webspace with minimum 64MB Ram for Multisite and use APC and Memcached on the Apache, cache not static and you can use all WP-functions without problems.
You scan via PageSpeed read also other options, there was coded in the theme. A cache can do a great work, but can not repair a bad theme or plugin.
A another solution is to use subdomains without cookies as CDN in WordPress.
Add this to the wp-config.php for the Cookies only on the domain, not the subdomain.
Now set new functions in the functions.php of the theme or write a plugin to replace the path form static content to your subdomains, your custom CDN.
now the function for template and stylesheet-path
Now read Page Speed on the frontend static CDN URLs without cookies.
Also add the follow source to the .htaccess for block dublicate content:
Please use the function, is also examples and you can write your solutions with my ideas.
Webserver stack
Essentially keep every operation in memory!
All my knowledge is open-source https://github.com/szepeviktor/debian-server-tools