Equivalent of Apache's SetEnv Variable

Michael Shadle mike503 at gmail.com
Thu Aug 5 14:22:19 MSD 2010

On Thu, Aug 5, 2010 at 3:16 AM, Grzegorz Nosek <grzegorz.nosek at gmail.com> wrote:

> type text/css {
>  expires max;
> }
> I think it's quite clean and conveys the idea better than:
> location ~ \.css$ {
>  expires max;
> }

I won't say that I am absolutely in support of this, just wanted to
add in my few cents on what the syntax should be, if it was to be

My biggest pet peeve is the conflicting location blocks. I've often
mentioned a "super location" idea, something that gets executed at the
very end of all the other rules, so that something like adding expires
headers can be done at the very end.

The idea of using this "type" methodology is nice though, as nginx
could in theory factor it in at the very end before it spits out the
content, examining the content-type header to determine "hey, this is
text/css! I should apply these rules on it" and not having to setup
regexp'ed locations that could conflict with other location blocks.

However, the biggest thing here is to see if there is a magic way to
stop "any url ending in .php to be parsed as PHP" using existing nginx
configuration or a small patch. That would make anyone who says there
is any sort of security hazard go back into their caves (as nginx
rarely has anything to be concerned about!)

More information about the nginx mailing list