Multiple sites under same domain with one app codebase

martyparish nginx-forum at
Fri Jul 18 15:17:22 UTC 2014

Thanks Francis!

Sorry for not being clear enough.

My code base is at:


The "site1, site2, etc..." folders do not exists at all. They are only seen
and used in the public URLs.

The original config I posted in the first post works, I just don't like it
because there will be hundreds of "sitesX". It is using a location block
with rewrite for each site.

so, if I request

The file that is served is 

/etc/nginx/html/production/index.php (not

Same for ALL sites. PHP processed the /site1/ path and loads the
configuration for that particular site.

So, really nothing is "broken", it is just going to be extremely ugly and
possibly slow to process 200+ location blocks.

I'd like to use a location regex that could handle ALL sites in one location
block if possible.

Or, I was thinking "map" may work but not sure how I could configure it. 

Thanks again for the help and let me know if this makes it more clear.


Posted at Nginx Forum:,251908,251916#msg-251916

More information about the nginx mailing list