Roots Discourse

Nginx config for multiple sites in sub-folders using common repo


#1

I’m looking for a clean method to have a common git repo and each site deploy as a sub-folder on a common domain.

Context
I have a handful of sites which use a common pattern (based on Bedrock) that currently have separate git repos and sub-domain installs. The nginx config for each aligns to this - http://pastebin.com/4ykrJEei - where root maps to /srv/www/example.ca/current/web and the location block is pretty standard.

The following config works - http://pastebin.com/GS47qaH2 - by setting a location to /site1 and modifying the bedrock structure to have the contents of /web/ moved into /web/site1. Functional, but not scalable off a single repo.

I’ve tried many config iterations from suggestions related to WP in sub-folder of domain with minimal success. Closest I got to was a scenario where accessing example.ca/site1/ would redirect cleanly to example.ca/site1/wp/wp-admin/install.php but generate a 404.

FYI - Eventually I’m going to move to either a multi-tenant or multi-site model, but for hosting environment reasons this is an interim solution I’m trying. Said environment is also RHEL based, so Trellis is not a direct option.