groupadd www-data

useradd -s /sbin/nologin -g www-data www-data

修正nginx.conf

nginx配置phpfpmnginx设置装备摆设支撑phpfpm Ruby

vim /etc/nginx/nginx.conf

......

#使nginx以www-data用户运行

user www-data;

......

#重新加载配置

service nginx reload

修正php-fpm.conf

vim /etc/php-fpm.d/www.conf

......

#使php-fpm以www-data用户和用户组运行

user = www-data

group = www-data

......

#nginx和php-fpm在同一做事器的话,推举利用unix socket进程间通讯

;listen = 127.0.0.1:9000

listen = /var/run/php71-fpm.sock

......

#设置.sock访问权限,需和nginx用户同等

listen.owner = www-data

listen.group = www-data

listen.mode = 0660

......

#重新加载配置

service php-fpm reload

配置nginx支持php-fpm

vim /etc/nginx/conf.d/default.conf

......

location ~ \.php$ {

root /usr/share/nginx/html;

#fastcgi_pass 127.0.0.1:9000;

fastcgi_pass unix:/var/run/php71-fpm.sock;

fastcgi_index index.php;

#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

......

#重新加载配置

service nginx reload

以上便是nginx配置支持php-fpm的详细内容