Which user should run my nginx or php-fpm processes

Ok I am a little confused about those permissions on Linux, so please, people help me. The problem is that I do not want to start the server as root, so I created another user with sudo privileges, so it starts the nginx and php-fpm servers (example "sudo_user"). But the problem is that I have "some_user" and it has a directory of its website "some_user / www.some_user.com" with all the configuration files, including database passwords, etc. I set the ownership of all files to some_user: some_user (user: group) and changed the permissions for all files 751 (u = rwx, g = rx, o = x so that other accounts could not just enter this directory and read each configuration file) and set to allow 755 open files. But my php-fpm works with "sudo_user" with the group "sudo_user ", it does not have permission to write or read configuration files in the" some_user "directory. What strategy should I take?

+3
source share
1 answer

It is probably best to create a group nginxand a group nginx, and run nginx / php under this user. You can then add the user nginxto your some_user / sudo_user groups with your authority of 751, and you must be installed.

+2
source

Source: https://habr.com/ru/post/1723451/