Add NGINX Users to nginx-agent Group
Complete the steps in this guide to manually add NGINX users to the nginx-agent group.
During installation, the NGINX Agent detects the NGINX user (typically
nginx) for the master and worker processes and adds this user to a group called
If you change the NGINX username after installing the NGINX Agent, you’ll need to add the new username to the
nginx-agent group so that the NGINX socket has the proper permissions.
A failure to update the
nginx-agent group when the NGINX username changes may result in non-compliance errors for NGINX Plus.
The NGINX Agent creates a socket in the default location
/var/run/nginx-agent/nginx.sock. You can customize this location by editing the
nginx-agent.conf file and setting the path similar to the following example:
nginx: ... socket: "unix:/var/run/nginx-agent/nginx.sock"
The socket server starts when the NGINX socket configuration is enabled; the socket configuration is enabled by default.
To manually add NGINX users to the
nginx-agent group, take the following steps:
sudo getent group | grep nginx-agent
The output looks similar to the following example:
If the group doesn’t exist, create it by running the following command:
sudo groupadd nginx-agent
Verify the ownership of
ls -l /var/run/nginx-agent
The output looks similar to the following:
total 0 srwxrwxr-x 1 root nginx-agent 0 Jun 13 10:51 nginx.sockvv
If the group ownership is not
nginx-agent, change the ownership by running the following command:
sudo chown :nginx-agent /var/run/nginx-agent
To add NGINX user(s) to the
nginx-agentgroup, run the following command:
sudo usermod -a -G nginx-agent <username>
For example to add the
nginxuser, take the following step:
sudo usermod -a -G nginx-agent nginx
Repeat for all NGINX users.