I am having trouble with my rewrite rules with my new NGINX install.
If I access the image manually like here:
incredible.devpreview.co/wp-content/blogs.dir/2/files/2011/05/stockvault-colorful-illustration108811.jpg
It shows up, but WordPress is looking for it here:
incredible.devpreview.co/files/2011/05/stockvault-colorful-illustration108811.jpg
Here is what is in my NGINX config file:
server {
listen 80;
server_name www.devpreview.co;
rewrite ^/(.*) http://devpreview.co/$1 permanent;
}
server {
listen 80;
server_name devpreview.co *.devpreview.co;
access_log /var/www/devpreview.co/logs/access.log;
error_log /var/www/devpreview.co/logs/error.log;
location / {
root /var/www/devpreview.co/public/;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
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 /var/www/devpreview.co/public/;
rewrite ^/.*(/wp-.*/.*.(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-includes/ms-files.php?file=$1 last;
expires 30d;
break;
}
The Nginx Multisite method outlined below has been tested and will work for subdomain Multisite installs and will also work with the domain mapping plugin.
To simplify the process of making future changes the server files are organized into 3 separate files. The first is nginx.conf which holds the basic configuration and tells the server where to find the vhosts.
nginx.conf
The next file will be the global WordPress include and will hold all our rewrite rules.
wp-multi.conf
The third file is our vhosts. If your using the domain mapping plugin you can include 1 line for each domain mapped site. You can also add additional static sites to this file if needed.
For further reading on using WordPress with Nginx see: WordPress Performance Server – Nginx – Debian “squeeze”