(fast)cgi and nginx - there has to be a better way

Reinis Rozitis r at roze.lv
Thu Sep 25 22:41:09 MSD 2008

> care to elaborate how deployment of on lighttpd is 10x faster than 
> deployment
> on nginx?

At some point as a person who has also used lighty for quite some time I can 
understand the initial posters thoughts (which maybe is not a slowdown of 
deployment rather tricky part of configuring) and here is why:

Basically because nginx lacks global locations (correct me if I am wrong but 
afaik now they are only in server scope) and if() works pretty nasty - it is 
sometimes tricky in case of virtualhosts to make the config look clean/nice 
and work as expected.

Like with the if() case 

In lighty it works the simple way:

some_global_setting = value;

if(something) {
    some_global_setting =  other_value_A;

if(something_else) {
    some_global_setting =  other_value_B;

Also maybe its not the common case but if you have multiple hosts you have 
to specify location ~ \.php$ { fastcgi_pass ... } for every single server {} 
where the php itself is rarely different for each host. In lighty you can 
specify it globally - fastcgi.server = (".php" =>  ( host))) .. and if you 
need a special configuration/version of php override it in other if().

Basically in lighty you can put everything in if() and keep some settings 
globally (like php backend / expire/gzip settings for certain 
file-types/location) but in nginx you can't... Which makes my nginx config 
at least twice (multiply by virtualhosts) the size of a lighty config file..

On the other hand don't see this as whining..
I like nginx and we have solved a lot of problems (like memory leaks and 500 
bad gateway errors) by switching to it. Which is primary.
Just would like to see some global location option (so I dont have to put 
location *.jpg expire 30d for every vhost) and maybe make the IF() more 


More information about the nginx mailing list