manu - NGINX uses different rewrite rules for subdirectory installations.
WordPress has details about it, I'm sure you've been pointed to this page before. I've added the script at the end of the post.
I'm also looking for the NGINX subdirectory rewrite for WordPress. I could try to figure it out from the NGINX site but it makes my head hurt looking at it and don't want to duplicate work if it's already been done. Would one just need to change 'example.com' in the NGINX script?
I was wondering if anyone had used the NGINX rewrites in Developer tools.
@Adam - the panel has a great interface to apply rewrite rules to websites. Would there be any chance of a 'cheat-sheat' for rewrite rules for NGINX?
##NGINX SUBDIRECTORY REWRITE RULES
map $uri $blogname{
~?P<blogpath>/[^/]+/files/(.*) $blogpath ;
}
map $blogname $blogid{
default -999;
#Ref: http://wordpress.org/extend/plugins/nginx-helper/
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
server {
server_name example.com ;
root /var/www/example.com/htdocs;
index index.php;
location ~ ^(/[^/]+)?/files/(.+) {
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example.com/htdocs/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
#add some rules for static content expiry-headers here
}
##END NGINX REWRITE RULES