Multiple sites under same domain with one app codebase

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


Thanks Francis!

Sorry for not being clear enough.

My code base is at:

/etc/nginx/html/production/

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 

domain.com/site1/index.php

The file that is served is 

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

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.


Marty

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251908,251916#msg-251916



More information about the nginx mailing list