nginx和php-fpm的用户权限

  1. 启动php-fpm
    sudo php-fpm -c /etc/php.ini
    [17-Sep-2018 00:36:59] ERROR: [pool www] please specify user and group other than root
    [17-Sep-2018 00:36:59] ERROR: FPM initialization failed

开始的时候,使用本机wyc用户名及group名staff,发现session写到了/var/tmp/下面,wyc帐户没有权限写,切换到root帐户,
php

切换到root帐户,及wheel组
nginx

php-fpm启动项里有-c能够容许用root启动
-R, --allow-to-run-as-root
Allow pool to run as root (disabled by default)session

2.切换Nginx的帐户,默认nobody,切换成root帐户,user root 会报错
➜ conf sudo /usr/local/openresty/nginx/sbin/nginx -s reload
nginx: [emerg] getgrnam("root") failed in /usr/local/openresty/nginx/conf/nginx.conf:3php-fpm

必须加上wheel组名就行了rest

相关文章
相关标签/搜索