nginx+php-fpm环境502错误,使用多个php-fpm将不同的网站分开

cp php-fpm.conf php-fpm1.conf 

复制一份php-fpm.conf配置文件修改监听

###
<value name="pid_file">/usr/local/php/logs/php-fpm1.pid</value>
<value name="listen_address">/tmp/php-cgi1.sock</value>
###

 

修改启动文件

cd /etc/init.d/
cp php-fpm php-fpm1
###
php_fpm_CONF=/usr/local/php/etc/php-fpm1.conf
php_fpm_PID=/usr/local/php/logs/php-fpm1.pid
###

 

修改nginx配置文件

location ~ .*\.(php¦php5¦html)?$ {
                try_files $uri =404;
                fastcgi_pass  unix:/tmp/php-cgi1.sock;
                fastcgi_index index.php;
                include fcgi.conf;
        }

启动php-fpm1,重启nginx

/etc/init.d/php-fpm1 start
/etc/init.d/nginx restart