# Multiple sites in subfolders

**URL:** https://discourse.roots.io/t/multiple-sites-in-subfolders/10766
**Category:** trellis
**Tags:** nginx
**Created:** 2017-10-30T00:50:42Z
**Posts:** 4

## Post 1 by @wickedst — 2017-10-30T00:50:42Z

**UPDATE: I have abandoned this in favour of subdomains for now, as those are supported by default.**

It looks like my question has been asked a few times on the discourse, namely in [this thread](https://discourse.roots.io/t/multiple-sites-trellis-subfolder/8923) but without a conclusive answer -

To clarify - I am aiming to set up a site on the main domain, eg. [site.com](http://site.com), then several sites as sub directories eg, [site.com/site1](http://site.com/site1), [site.com/site2](http://site.com/site2) etc.

As far as the Trellis configuration I believe I have correctly set up the multiple sites (provisioned vagrant with no errors and also wp\_home and wp\_siteurl set up correctly in wordpress\_sites.yml) - However unsurprisingly when visiting [site.com/site2](http://site.com/site2) it just loads the 404 of the main site.

I am guessing I have to configure nginx to send [site.com/site2](http://site.com/site2) to /srv/www/site2/current

So my main questions are

- If and how to set this up in nginx-includes
- Which conf do I set it up in? I am guessing it is on the main domain ie, /trellis/site.com/\*.conf.j2 (rather than in trellis/nginx-includes/site2/)

Or am I barking up the wrong tree completely? Thanks and appreciate the help

---

## Post 2 by @wickedst — 2017-10-30T12:04:51Z

I found this post containing an nginx configuration for a WP site installed as a subfolder: [http://www.shaolintiger.com/2013/04/22/installing-wordpress-in-a-sub-directory-using-nginx/](http://www.shaolintiger.com/2013/04/22/installing-wordpress-in-a-sub-directory-using-nginx/)

Code from the post:

```
location /subinstall {
root /home/maindomain.com/public_html/subinstall;
index index.php index.html index.htm;
try_files $uri $uri/ @wp;
}
location @wp {
rewrite ^/subinstall(.*) /subinstall/index.php?q=$1;
}
```

It seems like this would have to go in the main nginx.conf, repeated for each site ?

Having read the [nginx-includes documentation](https://roots.io/trellis/docs/nginx-includes/) my best guess is I should create a site template: [https://roots.io/trellis/docs/nginx-includes/#designate-a-site-template](https://roots.io/trellis/docs/nginx-includes/#designate-a-site-template)

Thanks again in advance for any help

---

## Post 3 by @ben — 2017-10-30T15:37:30Z

Is there a reason why you cannot use multisite?

---

## Post 4 by @wickedst — 2017-10-30T16:11:16Z

A few of the sites have already been developed and use plugins. I am not very experienced with multisite also, I am opened minded about it though
