brianmercer wrote:
1. Since the $host is part of the key, it probably will. Test it out, let us know, we'll adjust as needed. I tested an nginx config for WP3.0 multisite but never used it for anything.
I've got WPMU (dir based) set up as follows:
Code:
server{
.. as above..
## MU settings - starts
server_name_in_redirect off;
port_in_redirect off;
rewrite ^.*/files/(.*) /wp-includes/ms-files.php?file=$1;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
## MU settings - ends
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
set $nocache "";
if ($http_cookie ~ (comment_author_.*|wordpress_logged_in.*|wp-postpass_.*)) {
set $nocache "Y";
}
fastcgi_pass unix:/usr/local/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param CONTENT-LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 200 2m;
fastcgi_cache_bypass $nocache;
fastcgi_no_cache $nocache;
}
}
What I'm especially liking about this is that I could 'export' the whole .php section into an include file and reduce the size of the site config. Can be included by both standard and MU.
brianmercer wrote:
2. Yeah, that old module shouldn't be necessary with the 0.8.46+ directives.
There is a new module:
http://wordpress.org/extend/plugins/ngi ... che-purge/ which requires nginx to be compiled with the cache purge contrib module. Selectively purging updated posts and the front page and feeds ...that's definitely the next step, but I haven't tried it.
I may just try this. Hopefully soon. Will post a follow up when I do.
brianmercer wrote:
3. Dunno how practical that is. If one person makes a comment, do you want to save every page they visit afterward in case that same person revisits that exact page? Doesn't sound worthwhile. I can understand trying to cache portions of a site for all commenters, but not on an individual basis.
Yeah.. I think you are right.
brianmercer wrote:
4. The pages are cached as static files in /var/cache/nginx and you can go view them. The filenames are an md5 hash of the cache_key. If someone visits the same page and the cached page is still valid, the request is not passed to the php backend.
What confused me was my own ignorance. When I first played with fastcgi_cache I stuck some
error_log('hello'); statements in the WP theme files to determine whether I was getting cached hits or not. I now realise just how naive and wrong that is.
Thanks for your help Brian. Really appreciate it.