Compress location config

Igor Clark lists at ruby-forum.com
Wed Jan 6 22:39:45 MSK 2010


Hi there, you can put the fastcgi_param, fastcgi_index and include 
directives outside the location blocks, in fact according to 
http://wiki.nginx.org/NginxHttpFcgiModule they work in both server (per 
virtual host) and http (all virtual hosts) contexts. Then they should 
apply to all of the locations. fastcgi_pass needs to be per location. 
You could try gluing the paths together into a single regex if you 
really want, but it would probably be clearer to leave them separate, 
no?

cheers
Igor Clark


macindy wrote:
> Hi nginx community!
> 
> I am new to nginx and my regex knowledge is just basic.
> Can somebody help me to compress these three rules:
> 
> 
>                 location ~ ^/forum/vbseo_sitemap/.+\.php$ {
>                   fastcgi_param SCRIPT_FILENAME 
> $document_root$fastcgi_script_name;
>                   fastcgi_index index.php;
>                   fastcgi_pass  phpload;
>                   include       /etc/nginx/fastcgi_params;
>                 }
> 
>                 location ~ ^/forum/.+\.php$ {
>                   fastcgi_param SCRIPT_FILENAME 
> $document_root/forum/vbseo.php;
>                   fastcgi_index index.php;
>                   fastcgi_pass  phpload;
>                   include       /etc/nginx/fastcgi_params;
>                 }
> 
>                 location ~ .*\.php$ {
>                   fastcgi_param SCRIPT_FILENAME 
> $document_root$fastcgi_script_name;
>                   fastcgi_index index.php;
>                   fastcgi_pass  phpload;
>                   include       /etc/nginx/fastcgi_params;
>                 }
> 
> 
> Thanks - Best regards
> macindy
> 
> Posted at Nginx Forum: 
> http://forum.nginx.org/read.php?2,36765,36765#msg-36765

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list