Condensing Location Directives

arosolino nginx-forum at nginx.us
Mon Jul 23 17:37:31 UTC 2012


I have this setup for my location directives

		location /css/ {
			proxy_pass	http://127.0.0.1:8080/css/;
		}
		
		location /js/ {
			proxy_pass	http://127.0.0.1:8080/js/;
		}

It seems a bit repetitive to me, is it possible to do something like
this.

		location /css/, /js/ {
			proxy_pass	http://127.0.0.1:8080/$1;
		}

Where you can have one block process multiple locations, then the
variable $1, copies the location defined into the proxy_pass URL? I
might have about 10-20 and it would be easier to have one block then 20.

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



More information about the nginx mailing list