The following error occurred when the blogger started the Nginx service
[root@localhost ~]# /usr/local/nginx/sbin/nginx
nginx: [emerg] getpwnam("nginx") failed
The function of getPwnam in the error message is to get information about the user’s login
So you can see that getting “nginx” users failed
Query the user with id, and sure enough, it does not exist
[root@localhost ~]# id nginx
id: nginx: no such user
Once the user is added, it works
[root@localhost ~]# useradd -M -s /sbin/nologin nginx
[root@localhost ~]# /usr/local/nginx/sbin/nginx
[root@localhost ~]# netstat -anpt | grep nginx
tcp 0 0 10.0.0.100:80 0.0.0.0:* LISTEN 3843/nginx: master
Recall that the configuration for source code compilation and installation was as follows
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && make && make install
At that time, the user group and user group of Nginx were set. In the absence of nginx users in the system, it could not be started naturally.
Read More:
- Nginx start error: job for nginx.service failed because the control process exited with error code
- Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”
- nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
- nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
- /var/run/nginx/nginx.pid” failed (2: No such file or directory)
- CentOS7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument?
- nginx: [error] open() “/usr/local/var/run/nginx.pid” failed (2: No such file or directory)
- nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
- nginx: open() “/var/run/nginx.pid“ failed (2: No such file or directory)
- nginx: [error] invalid PID number ““ in “/data/nginx/logs/nginx.pid“
- Nginx error: nginx: [error] invalid PID number “” in “/run/nginx.pid”
- nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
- Ubuntu failed to start sshd with an error: failed to start OpenBSD secure shell server
- Error: (serious: a child container failed during start) (server component failed to start so Tomcat is unable)
- Solve the problem of starting nginx nginx.pid error
- Tdengine failed to start, start request repeated too quickly for taosd.service
- MySQL failed to start prompt: job failed to start
- Zookeeper Failed to Start Error: start failed [How to Solve]
- nginx: [error] invalid PID number in /var/run/nginx.pid
- Net start mongodb failed to start: system error 5 has occurred. Access is denied