Compress location config

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:

Hi there, you can put the fastcgi_param, fastcgi_index and include
directives outside the location blocks, in fact according to
Module ngx_http_fastcgi_module 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 C.

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:
Compress location config

Great! Thanks

Posted at Nginx Forum:

macindy wrote:

fastcgi_param SCRIPT_FILENAME $document_root/forum/vbseo.php;
}
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

On Fri, Jan 8, 2010 at 12:56 PM, macindy [email protected] wrote:

Great! Thanks

Posted at Nginx Forum: Re: Compress location config


nginx mailing list
[email protected]
nginx Info Page

FYI, fastcgi_index is useless in these blocks.

– Merlin