Nginx 仅在将工作进程用户设置为 root 时有效

Nginx only works when setting worker-process user to root

在 CentOS7 上将 nginx worker-process 用户设置为不同于 root 时,returns 找不到 404。

在 nginx.conf

中与 user root; 合作
root      3776  0.0  0.1  46580  1056 ?        Ss   15:28   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root      3777  0.0  0.3  47008  3540 ?        S    15:28   0:00 nginx: worker process

无法在 nginx.conf

中使用 user nginx;
root      3837  0.0  0.1  46580  1056 ?        Ss   15:35   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     3838  0.0  0.3  47008  3540 ?        S    15:35   0:00 nginx: worker process

error.log

2019/06/07 15:35:06 [crit] 3838#3838: *1 stat() "/mnt/projects/samir" failed (13: Permission denied), client: [removed], server: [removed], request: "GET / HTTP/1.1", host: "[removed]"

我需要添加什么权限?我测试了将文件夹组更改为 nginx:nginx,添加 777 权限,755 也进行了测试。

解决方案:

chmod +x -R /mnt/projects