problems with php-fpm

Samuel Vogel samydelux at gmail.com
Wed Aug 27 03:04:33 MSD 2008


Hey guys,

I am new to nginx an I am trying to set up nginx with php support 
through php-fpm.
When I start php-fpm, it does spawn some php processes:
# ps aux | grep php
root     30292  0.0  0.0  11852  2752 ?        Ss   Aug26   0:00 
/usr/bin/php-cgi --fpm --fpm-config /etc/php5/php-fpm.conf
www-data 30296  0.0  0.0  11900  2460 ?        S    Aug26   0:00 
/usr/bin/php-cgi --fpm --fpm-config /etc/php5/php-fpm.conf
www-data 30297  0.0  0.0  11900  2460 ?        S    Aug26   0:00 
/usr/bin/php-cgi --fpm --fpm-config /etc/php5/php-fpm.conf

This seems about right, ain't it?
I have configured nginx with the standart config, that comes with the 
debian package (0.6.32). My fastcgi conf looks like this:
        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;
        }


# cat /etc/nginx/fastcgi_params
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
#fastcgi_param  REDIRECT_STATUS    200;


Unfortunately I get an 50x error and the following is written to the 
error.log:
2008/08/27 00:51:00 [error] 26403#0: *1 recv() failed (104: Connection 
reset by peer) while reading response header from upstream, client: 
xx.xx.xx.xx, server: localhost, request: "GET /index.php HTTP/1.1", 
upstream: "fastcgi://127.0.0.1:9000", host: "xx.xx.xx.xx"

Searching the web I found out, that this error relates to 
FCGI_WEB_SERVER_ADDRS not being set properly, but it is in my case:
<value name="allowed_clients">127.0.0.1</value>

php should also be listening on the right port:
<value name="listen_address">127.0.0.1:9000</value>

Does anybody have any hints for a nginx beginner?

Regards,
Samy





More information about the nginx mailing list