Equivalent of Apache's SetEnv Variable

Grzegorz Nosek grzegorz.nosek at gmail.com
Thu Aug 5 14:16:32 MSD 2010


On Thu, Aug 05, 2010 at 01:58:04PM +0400, Igor Sysoev wrote:
> Then it can be easy fixed by
> 
>    location ^~ /uploads/ {
> or
>    location ~ ^/uploads/ {

Sure. However this requires cooperation between the application user and
the server admin, which isn't always possible (e.g. in a shared hosting
setup it's infeasible to configure every application according to its
needs; everything must be set up well enough to work with automated
configuration).

> I never liked this Apache idea of internal MIME-types such as
> application/x-httpd-php, text/x-server-parsed-html, etc.
> I believe it confuses and complicates things.

The Apache approach to e.g. FastCGI is positively insane, but (for me at
least) the major problem is tying everything to filesystem paths, not
assigning everything a MIME type.

Thankfully, those days are gone by, but I remember setting up a fake
path to some nonexistent ScriptAlias'ed directory(?) just to run a
FastCGI server. I sincerely hope Nginx never goes that way ;) but if
a URL has been resolved to a real file on disk, we do have a proper MIME
type we could use. Apart from the internal types like you (and I)
mentioned, Mike proposed a less controversial (IMHO) use case:

type text/css {
  expires max;
}

I think it's quite clean and conveys the idea better than:

location ~ \.css$ {
  expires max;
}

Best regards,
 Grzegorz Nosek



More information about the nginx mailing list