Compress location config

Tobia Conforto tobia.conforto at gmail.com
Fri Jan 8 18:35:19 MSK 2010


macindy wrote:
> 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;
> }

This should be equivalent to yours:

location ~ ^/forum/(?!vbseo_sitemap/).+\.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;
}

-Tobia



More information about the nginx mailing list