Nginx combined with WP Super Cache for WordPress Mu is an interesting idea. However, you can potentially set up a simpler, and superior caching system using internal Nginx features that replaces the need for Super Cache.
I will be working on this WP Super Cache replacement using Nginx but in the mean time here is a set up for Nginx and WP Super Cache rewrites.
First you need install 0.6.29 or up which has a module called Gzip Pre-Compression Module. Download and unzip the latest Nginx. Then set it up like this:
./configure --with-http_gzip_static_module --with-http_ssl_module
make
sudo make install
In the http area of your nginx.conf file include:
gzip_static on;
gzip_http_version 1.1;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
Now what the above setting does is makes Nginx first see if there is a file in the directory already gzipped. If there is no gzip file Nginx will gzip the file on the fly then send the file out.
Now for the rewrites:
server {
listen 80;
server_name yourmublogs.com *.yourmublogs.com;location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root /home/yourmublogs/public_html;
rewrite ^/.*(/(wp-admin|wp-includes)/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-content/(themes|plugins|mu-plugins)/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-content/blogs.php?file=$1 last;rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-content/blogs.php?file=$1 last;
expires 10d;
break;
}location / {
root /home/yourmublogs/public_html;
index index.html index.htm index.php;if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
}if ($http_cookie !~* “comment_author_|wordpress|wp-postpass_” ) {
rewrite ^(.*)$ /wp-content/cache/supercache/$http_host/$1index.html;
break;
}error_page 404 = @tricky;
}location @tricky {
rewrite ^ /index.php last;
rewrite ^/.*(/wp-login.php)$ $1;
rewrite ^/.*(/wp-admin/.*\.php)$ $1;
rewrite ^/.*(/wp-includes/.*\.php)$ $1;
fastcgi_pass 127.0.0.1:8084;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/yourmublogs/public_html$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}server {
server_name www.yourmublogs.com;
rewrite ^/(.*) http://yourmublogs.com/$1 permanent;
}
Ajax could be used for commenting.

2 Comments
Thanks
Hi, many thanks for these tips. I am having some problems with nginx as front end to apache for a WordPress blog, and am having troubles with SuperCache’s static files.
I will try with your configuration, in the meantime: have you already done something to replace SuperCache by only using nginx?
This would be great.
Thanks