Multiple URL parameters in the same location directive.

Barry Abrahamson barry at automattic.com
Sun Oct 28 04:35:06 UTC 2012


On 10/27/12 11:59 PM, Quintin Par wrote:

> How can I combine them into one line?

You *could* combine them into one line using a regex, but I would not
recommend it - it will be more complicated to maintain over time and
less readable.  I would recommend putting all of your common
configuration directives into a separate file and including it in each
individual location block.  Something like this:

location = /robots.txt {
	include common-config.conf;
}

location = /sitemap.xml {
	include common-config.conf;
}

...

I would also be sure to read the documentation on location syntax [0] to
understand the differences between exact, prefix, and regex matches so
you are sure to use the correct type for each pattern you are trying to
match.

Hope this is useful.

References:
0. http://nginx.org/en/docs/http/ngx_http_core_module.html#location

-- 
Barry Abrahamson | Systems Wrangler | Automattic
Blog: http://barry.wordpress.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121028/72f82ce1/attachment.bin>


More information about the nginx mailing list