How To Configure Multiple WordPress Sites in Subdirectories in nginx

March 8, 2014 5.4k views
Can i have multiple WordPress installations in subdirectories in nginx? Example: - demo.com/site1 - demo.com/site2 - demo.com/site3 How can i do this with permalinks working?
5 Answers
I followed this tutorial:
https://www.digitalocean.com/community/articles/how-to-configure-single-and-multiple-wordpress-site-settings-with-nginx

So, i added a "location sitex.." for each site.

Something like this: http://pastebin.com/xXygC5eN
by Santiago Ti
WordPress is the most popular CMS (content management system) used on the internet today. WordPress sites can be served using a HTTP server such as Apache or NGINX, while Apache is a great option to serve websites, many sites have moved to NGINX because of it's scalable event-driven architecture, low resources and better delivery of statics files. In this tutorial, you will learn how to configure NGINX for various types of WordPress installations, including multisite configurations, rewrite rules and the use of .conf files to apply repeated configurations.

i did it like this and works fine even for permalinks! (diud not get the permalinks working with the pastebin example)

        root /var/www/siteroot
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name domain.com;

        location / {
                try_files $uri $uri/ =404;
        }


        location /site1 {
                index index.php index.html index.htm;
                try_files $uri $uri/ /site1/index.php?q=$uri&$args;
        }

        location /site2 {
                index index.php index.html index.htm;
                try_files $uri $uri/ /site2/index.php?q=$uri&$args;
        }
Take a look at installing easyengine on your droplet to take care of Nginx , WordPress and subfolders/server blocks.
Look here https://rtcamp.com/easyengine/docs/commands/site/create/
Hi, I found a solution.

But I will try easyengine. Seems to be easy.

Thanks!
Hi Rodrigo,

Could you please share your solution with me?

Thanks
Have another answer? Share your knowledge.