Global PHP Rule

Jim Ohlstein jim.ohlstein at gmail.com
Mon May 4 04:56:40 MSD 2009



Michael Shadle wrote:
> On Sun, May 3, 2009 at 5:06 PM, Mathew Davies
> <thepixeldeveloper at googlemail.com> wrote:
>
>   
>> location ~ \.php$
>> {
>> fastcgi_pass 127.0.0.1:9000;
>> fastcgi_index index.php;
>> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>> include fastcgi_params;
>> }
>> }
>>     
>
> You can put these in fastcgi_params:
>
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>
> Also you can put all the fastcgi_params globally on the http {} block.
>
> I have done that, and it works well, there is some random situation
> though where if I try to override a fastcgi_param somewhere else, all
> of them get unset.
>
>   
Correct me if I'm wrong, but you still have to put

location ~ \.php$ {
	fastcgi_pass 127.0.0.1:9000;

	...
}

for each server block where you want to configure php. Even if you are able to put the fastcgi_pass directive into fastcgi_params, something I haven't tried, you'd still need

location ~ \.php$ {

	include fastcgi_params;
} 

in any server block where you wanted to run run php scripts since fastcgi_pass has to be in a location block.


Jim







More information about the nginx mailing list