Multiple sites under same domain with one app codebase

martyparish nginx-forum at nginx.us
Fri Jul 18 16:23:21 UTC 2014


Okay, I finally got the mapped variable figured out!

	map $uri $site_folder {
	  ~^/(?P<folder>[a-zA-Z]+)/.*        $folder ;
	}

Now, I just need to figure out how to use it in the location block???

This is what I am trying:

		location ^~ /$site_folder/ {
			#rewrite ^/$site_folder/(.*) /$1;  
		}


Is it okay to use the named variable in the location like that? It's not
picking it up...

If I use this:

		location ^~ / {
			return 301 $scheme://www.google.com?q=$site_folder;
		}

It DOES redirect to google with the proper variable in there.

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



More information about the nginx mailing list