After nginx is started successfully, it cannot be accessed
Check that nginx.pid does not have a port number, but the startup is normal,
[ root@rzk nginx]# ./nginx -t
nginx: the configuration file /opt/Nginx/nginx/nginx.conf syntax is ok
nginx: configuration file /opt/Nginx/nginx/nginx.conf test is successful
Check the logs. Error.log to confirm the errors in these lines
2021/11/22 17:26:51 [error] 188975#0: open() “/opt/Nginx/nginx/nginx.pid” failed (2: No such file or directory)
2021/11/22 17:27:07 [notice] 188978#0: signal process started
2021/11/22 17:27:07 [error] 188978#0: invalid PID number “” in “/opt/Nginx/nginx/nginx.pid”
Solution (I)
/Opt/nginx/nginx/nginx.pid check whether the file exists. If not, create a new MKDIR nginx.pid, save and exit
If the above problems cannot be solved
Solution (II)
Open comment
Enter the configuration file VIM/opt/nginx/nginx/nginx. Conf
Look at line 7 and you can see that the PID is annotated
Modify PID storage path
It can be modified to PID/opt/nginx/nginx/nginx.pid; Here I exist under the nginx root path
After saving, execute the following command. Because/opt/nginx/nginx/nginx.pid is opened, the execution configuration file will generate the corresponding nginx. PID
-C specify a file, that is, specify the accessory file
[root@rzk nginx]# ./nginx -c /opt/Nginx/nginx/nginx.conf # If you want to specify a configuration file to start then use the following command,
[root@rzk nginx]# cat nginx.pid View pid
189585
Then you can check the nginx startup
Similar Posts:
- PHP FPM and Nginx start normally, page 502 Error [How to Solve]
- nginx Server Start Error: nginx: [emerg] open() “/var/run/nginx/nginx.pid” failed (Linux Restart)
- Nginx Error: nginx: [error] CreateFile() “D:\nginx-1.20.1/logs/nginx.pid” failed (2: The system cannot find the file specified)
- [Solved] Nginx Restart Error: nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)
- [Solved] Nginx restart error: nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
- Nginx Error: Nginx 403 error:directory index of “xxx“ is forbidden
- Nginx Error: nginx: [emerg] “server” directive is not allowed here in
- nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
- [Solved] Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid
- Nginx Failed to Starup Error: [emerg] mkdir() “/var/tmp/nginx/client” failed (2: No such file or directory)