Multiple sites in subfolders

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 but without a conclusive answer -

To clarify - I am aiming to set up a site on the main domain, eg. site.com, then several sites as sub directories eg, site.com/site1, 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 it just loads the 404 of the main site.

I am guessing I have to configure nginx to send 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

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/

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 my best guess is I should create a site template: https://roots.io/trellis/docs/nginx-includes/#designate-a-site-template

Thanks again in advance for any help

Is there a reason why you cannot use multisite?

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