nginxpermissionscentoshttp-status-code-404worker-process

Nginx only works when setting worker-process user to root


When setting nginx worker-process user to different than root on CentOS7 it returns 404 not found.

working with user root; in nginx.conf

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

not working with user nginx; in nginx.conf

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

On 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]"

What permissions I need to add ? I tested changing group of folder to nginx:nginx, adding 777 permission, 755 tested also.


Solution

  • Solution:

    chmod +x -R /mnt/projects