GEOIP context problem

Maxim Dounin mdounin at mdounin.ru
Tue Aug 31 19:51:09 MSD 2010


Hello!

On Tue, Aug 31, 2010 at 11:38:38AM -0400, syle wrote:

> Actually I'll post one of my server directives so we can see if there is
> any inheritance problems like 
> you suggested, i have about 50 server directives the same as this: 
> ( I know it seems quite bloated but I didn't read any way I could set
> php and perl/cgi scripts outside of 
> server directivesfor all the vhosts)
> 
> 
> server {
>     listen       80;#bind to ipv4
>     listen       [::]:80; #bind to ipv6
>     server_name  x.x.x;
>     root   /xxx/xxx/xxx;
>     access_log  /usr/nginx_logs/xxx_xxx_log main;
>     error_log  /usr/nginx_logs/xxx_xxx_error;
>     index  index.php index.pl index.html;
>     error_page  404              /xxx/xxx.pl;
>     error_page   500 502 503 504  /xxx/xxx.pl;
>     location ~ \.php$ {
>         fastcgi_index  index.php;
>         fastcgi_pass  unix:/tmp/cgi2.sock;
>         fastcgi_param  SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
>         include        fastcgi_params;
>     }
>     location ~ \.pl$ {
>         fastcgi_pass  unix:/tmp/cgi.sock;
>         fastcgi_param  SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
>         include        fastcgi_params;
>     }
> }
> 
> ---- i do see params being set in location as you said would not work,
> So are you saying i would have to add all those GEO_IP directives to all
> 50 server directives :(  perhaps maybe can suggest a way to move these
> perl and php directives outside server directives into http context to
> work with GEOIP? or I have to hope for a freebsd commit to stop removing
> that file I suppose.

As long as all fastcgi_param's are identical in all locations - 
you are free to move all of them to http level.

Alternatively - nothing stops you from using another include file 
for these params.

Maxim Dounin



More information about the nginx mailing list