How to run multiple WordPress installations on one NGINX?

If you ever would like to run multiple WordPress installations on one NGINX server and sharing one domain name. Also you would like to have nice urls like /%catetgory%/%postnname%/ on both of them. You better do not do it in the root configuration block like this:

location / {
  try_files $uri $uri/ /index.php?$args /another-nestetd-wp/index.php?$args;
}

Of course this will work… but as a side effect posts from /another-nested-wp/ will be leaking into main blog RSS feed. Trust me 🙂 I’ve only found out about this thanks to JVM Bloggers and my colleagues asking me wether my site was hacked 😀

Some things one need to learn the hard way.

Nevertheless, proper NGNIX, configuration should be done for /another-nested-wp/ (not root node):

location /another-nested-wp/ {
  try_files $uri $uri/ /another-nested-wp/index.php?$args;
}

This way both blogs shouldn’t interfere with each other. And both can use nice urls 😉

One again many thanks to the community from JVM Bloggers for quick information about this (self)hack 😉

Leave a Reply

Your email address will not be published. Required fields are marked *