Setup notes: nginx + wordpress multi site


  • Your domain name
  • Extra domains if your also using extra domain mapping in wordpress
  • file_root: Path to your wordpress install



# WordPress Multi Site Domain
server {
    listen 80 ;

    root /file_root/wordpress;
    index index.php index.html index.htm;

    # Rewrite for multi site files
    rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;

    # Rewrite for wordpress
    if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php?q=$1 last;

    location ~ .php$ {
        fastcgi_pass    unix:/tmp/php-fastcgi.socket; # or port like
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;


sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo service nginx restart
This entry was posted in Server, Uncategorized. Bookmark the permalink. Both comments and trackbacks are currently closed.


  1. Joe Malik
    October 27, 2011 1:12 am

    Hey, that definately saved my day! Thx!

    • October 27, 2011 8:26 am

      Thanks mate! Kind words always appreciated.

  2. May 7, 2012 1:11 am


    Thanks for this. Will it work with sub-domains and directories in a WordPress network?



    • May 7, 2012 12:00 pm

      Hi Joe, I don’t know what changes would be required for a sub-directory setup. I’ve only every employed the sub-domain setup. I know the instructions are a bit terse and probably designed for people who already have nginx / php experience but if you have any trouble setting up a sub-domain install feel free to post more questions.