Roots Discourse

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


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.

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 - - where root maps to /srv/www/ and the location block is pretty standard.

The following config works - - 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 would redirect cleanly to 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.