Setup notes: nginx + wordpress multi site

Substitute

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

Files

/etc/nginx/sites-available/domain_name1.com

# WordPress Multi Site Domain
server {
    listen 80 ;
    server_name .domain_name1.com .extra_domain_name.com;

    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 127.0.0.1:9000
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
}

Finish

sudo ln -s /etc/nginx/sites-available/domain_name.com /etc/nginx/sites-enabled/domain_name.com
sudo service nginx restart
This entry was posted in Server, Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  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.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>