Equivalent of Apache's SetEnv Variable

Grzegorz Nosek grzegorz.nosek at gmail.com
Thu Aug 5 14:49:37 MSD 2010


On czw, sie 05, 2010 at 02:44:19 +0400, Igor Sysoev wrote:
> Well, how can you express this
> 
>     location ~ ^/dev/.*\.css$ {
>         root   /path/to/dev;
>         expires off;
>     }
> 
>     location ~ \.css$ {
>         root   /path/to/production;
>         expires max;
>     }
> 
> using mime-types ?

Dunno, how about:

location /dev {
  root /path/to/dev;
  # ...
  type text/css {
    expires off;
  }
}

location / {
  root /path/to/production;
  # ...
  type text/css {
    expires max;
  }
}

1. Yes, this requires nesting type{} in location{}

2. I don't expect everybody to drop regex locations in favour of type{},
I just expect it'll make some types of configuration easier, just like
try_files did.

Best regards,
 Grzegorz Nosek



More information about the nginx mailing list