Question

How To Configure Multiple WordPress Sites in Subdirectories in nginx

Posted March 8, 2014 13.8k 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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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 a popular CMS (content management system). In this tutorial, you will 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
Submit an Answer