Multiple URL parameters in the same location directive.

Quintin Par quintinpar at gmail.com
Sun Oct 28 10:25:04 UTC 2012


Is there a way I can specify this in the same file itself? I don’t want to
spread this out to multiple files.

Include a section?
- Quintin

On Sun, Oct 28, 2012 at 10:05 AM, Barry Abrahamson <barry at automattic.com>wrote:

> 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
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121028/f6bf5e71/attachment-0001.html>


More information about the nginx mailing list