Nginx Rewrite - WP3 MS + BP + WPMUDev Plugins

Its not a question but more towards a solution for those who are interested in walking this path. I was developing my site in WPMU but with WP3 just round the corner I thought it wiser to go down this path.

Couldn't find a working solution online so came up with my own that appear to work across the board so posting here for other peoples benefit.

Reasons why i came up with this solution is that my old WPMU Nginx Rewrites that I got working using WPMU 2.9.2 didn't work with WP3 as there are some core file changes in WP3, the usual BP Avatar upload/display issues you have with Nginx, plus I also noticed that whilst the Media Library images would display the first time round if you did a simple refresh in your browser they would disappear.

location / {
root /www/root;
index index.php;

gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;

if (!-e $request_filename) {
rewrite ^.+/?(/ms-.*) $1 last;
rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1 last;
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
expires 10d;
break;

}
}

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 /www/root;
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;
if (!-e $request_filename) {
rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;
}

expires 30d;
break;
}

They're not perfect but they seem to work as far as I can tell. Just waiting on the final release of WP3 and the release of the WPMUDev plugins to match. In the meantime I will see if I can refine them a bit more.

  • dink
    • Flash Drive

    Maybe you can point me in the right direction as I've come across a little issue.

    I'm testing Supporter plugin with PayPal Sandbox and looking into why the accounts aren't being activated on additional sites I've set up. Cleared the databases and checked Paypal IPN and everything seems fine that end. WP3 is installed using subdomains and I'm using pure Nginx with php-fastcgi.

    The IPN says that it sent the response to http://betatester.mysite.com/supporter-paypal.php

    If I visit the above URL using FF i get the correct message "Error: Missing POST variables. Identification is not possible". However, if I do it in IE8 I get a 404 page instead.

    I can easily swap between a pure Nginx setup and a Nginx Proxy/Apache setup. Whilst the problem exists on pure Nginx setup it disappears when using the Nginx Proxy/Apache setup and works using both browsers.

  • dink
    • Flash Drive

    I've been playing around somewhat since I last posted with everything I can think of.

    Additional rewrites I've now taken out as they were there because for some reason BP avatars weren't uploading and showing properly when I first tried them a few weeks back. Removed all plugins to see if it was one of those causing the problems but no different.

    I've just done a clean build and got it working. I'll test the Upgrades plugin next and make sure they work. Then put my site back bit by bit and continue to test along the way to see if anything beaks it.

    I'll report back if I come across anything.

    As always, thanks.

  • dink
    • Flash Drive

    I've been playing around somewhat since I last posted with everything I can think of.

    Additional rewrites I've now taken out as they were there because for some reason BP avatars weren't uploading and showing properly when I first tried them a few weeks back. Removed all plugins to see if it was one of those causing the problems but no different.

    I've just done a clean build and got it working. I'll test the Upgrades plugin next and make sure they work. Then put my site back bit by bit and continue to test along the way to see if anything beaks it.

    IE still has a problem though.

    I'll report back if I come across anything.

    As always, thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.