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账户,

切换到root账户,及wheel组

php-fpm启动项里有-c可以允许用root启动
-R, --allow-to-run-as-root
Allow pool to run as root (disabled by default)

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:3

必须加上wheel组名就好了

猜你喜欢

转载自www.cnblogs.com/mentalidade/p/9658605.html