minimal fastcgi config for 1 file?

Grant emailgrant at gmail.com
Thu Feb 13 13:50:18 UTC 2014


>> Is it OK to use a minimal fastcgi configuration for a single file like this:
>>
>> location ~ ^/piwik/piwik.php$ {
>
> It doesn't make sense to use regular expression here.  Instead,
> use exact match location:
>
>     location = /piwik/piwik.php {

I'm only using one instance of location = or ^~ and that is on a very
frequently used location.  Should I keep it that way for performance?
The idea is that nginx won't have to evaluate all of the other
locations when the frequently used location is accessed.

>>     fastcgi_pass unix:/run/php-fpm.socket;
>>     include fastcgi_params;
>
> The "fastcgi_params" file as shipped with nginx doesn't set the
> SCRIPT_FILENAME parameter, and php will likely unable to handle
> such a request.  Use "include fastcgi.conf;" instead if you don't
> need SCRIPT_FILENAME customization.

I noticed my distro doesn't include any of the following in
fastcgi_params and only the first of these in fastcgi.conf:

SCRIPT_FILENAME
PATH_INFO
PATH_TRANSLATED

They are all included in fastcgi_params in the example here:

http://wiki.nginx.org/PHPFcgiExample

Should they all be added to fastcgi_params?

- Grant



More information about the nginx mailing list