Multiple URL parameters in the same location directive.

Barry Abrahamson barry at
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

Hope this is useful.


Barry Abrahamson | Systems Wrangler | Automattic

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the nginx mailing list