Tricky Rewrite rules.

HonDev Developer developerhondev at gmail.com
Thu Nov 22 14:47:15 MSK 2007


I have not had problems with wp-cache on php 5.2.x and fastcgi.  I
have wp-cache running fine on some other single wordpress installs.

I tried setting up a new mu wordpress install but got a 405 error with
the config.  Wordpress entered the upstream name "bugaloo" in the
install set up by default.

upstream bugaloo {
          server  127.0.0.1:81;
}

server {
        listen       80;
		  server_name  xx.yy.zz.com;
location / {		
root   /home/monkeyking/public_html;
index  index.html;


if ($query_string !~ ".*s=.*") {
 rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}

if ($http_cookie !~ "^.*comment_author_.*$" ) {
 rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}

if ($http_cookie !~ "^.*wordpressuser.*$" ) {
 rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}

if ($http_cookie !~ "^.*wp-postpass_.*$" ) {
 rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html
break;
}

error_page 404 = @tricky;
}

location @tricky {
proxy_pass      http://bugaloo;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
}


server {
listen       81;
server_name  xx.yy.zz.com;

access_log  logs/monkeyking.access.log;

location / {
root   /home/monkeyking/public_html;
index  index.php;

rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;

if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
}





More information about the nginx mailing list