Equivalent of Apache's SetEnv Variable

Igor Sysoev igor at sysoev.ru
Thu Aug 5 14:44:19 MSD 2010


On Thu, Aug 05, 2010 at 12:16:32PM +0200, Grzegorz Nosek wrote:

> 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;
> }

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 ?


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list