Declare a block so as to be shared between locations

Steve Holdoway steve at greengecko.co.nz
Thu Sep 26 07:23:35 UTC 2013


On 26/09/13 19:20, Maurizio De Santis wrote:
> I have two locations, /a and /b . Both of them share these directives
>
>     expires max;
>     add_header Cache-Control public;
>     add_header ETag "";
>     break;
>
> and location /b to has gzip_static on too.
>
> Is there a way to write this without writing two times the common 
> directives?
> That is, without rewriting the common directives like this:
>
> location /a {
>     expires max;
>     add_header Cache-Control public;
>     add_header ETag "";
>     break;
> }
>
> location /b {
>     gzip_static on;
>     expires max;
>     add_header Cache-Control public;
>     add_header ETag "";
>     break;
> }
>
> Generally speaking, is there a way to declare a block so as to be 
> shared between two or more locations without rewriting the common 
> directives?
>
> Thank you
>
> -- 
>
> Maurizio De Santis
>
include them from a remote file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130926/db3e84a3/attachment.html>


More information about the nginx mailing list