[SOLVED] Re: Multiple sites under same domain with one app codebase
    martyparish 
    nginx-forum at nginx.us
       
    Sat Jul 19 14:32:46 UTC 2014
    
    
  
For anyone who comes across this scenario, here is how I got it working:
# get the first folder name into a variable ($site_folder)
	map $uri $site_folder {
	  ~^/(?P<folder>[a-zA-Z]+)/.*        $folder ;
	}
...
	server {
		...
		
		if (!-f $site_folder) {
			rewrite ^/[^/]+/(.*) /$1;
		}
}
I am aware of the "if is evil" thing but it states that it is safe outside
of "location" block. Supposedly safe in "server" context.
Performance seems good so far.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251908,251938#msg-251938
    
    
More information about the nginx
mailing list