After googling like a madman and trying to learn russian the hard way I thought I should write down how I got nginx and Wordpres ยต 2.6 working with multiple sites on a FreeBSD-server.
Reading the forums I found this thread which in parts made the whole thing work. First I installed nginx, PHP5, Mysql and FastCGI. The next step is to download wpmu’s latest build and head over to wpmudev.org after the Multi-Site Manager Plugin.
The hard thing is configuring the nginx-server and writing the rewriterules. Thanks to the posts in the forum I found this setup to work.
nginx.confserver {listen 80; servername wpmusite.com *.wpmusite.com someotherdomain.com yetanother.com; charset utf-8; 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 /usr/local/www/wpmu; 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-content/blogs.php?file=$1 last; expires 10d; break;} location / { root /usr/local/www/wpmu; index index.php; if (!-e $request_filename) { rewrite ^.+/?(/wp-.*) $1 last; rewrite ^.+/?(/.*\.php)$ $1 last; rewrite ^(.+)$ /index.php?q=$1 last;}} location ~ .php$ { fastcgi_pass localhost:10004; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/www/wpmu$fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length;}
To add another site to my wpmu-installation I just add the domain after servername, point the DNS to the right ip-adress and add the site with the Multi-Site Manager-plugin.
I have tested to add new sites, blogs and upload files. It all seem to work ok but I’m no way certain it’ll work for other *nix distros or with advanced plugins. There’s probably a million ways this setup could be improved and/or broken! I’m espacially worried about how nginx handles the rewrites as I don’t fully understand the syntaxes yet.
Please point me towards any problems with this setup and I’d be glad to update the howto.





That rocks out xazax – thanks for sharing and we really look forward to anything else you can share with the community via wpmu.org!
great, usefull 0_0
Found some better rewrite rules!
http://article.gmane.org/gmane.comp.web.nginx.english/4739
Substitute the
if (!-e $request_filename) {rewrite ^.+/?(/wp-.*) $1 last;
rewrite ^.+/?(/.*\.php)$ $1 last;
rewrite ^(.+)$ /index.php?q=$1 last;}
with
error_page 404 = /index.php?q=$uri;