When we use systemctl restart When the nginx command restarts the service, an error is found as follows:
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
First, we can use systemctl status nginx View current nginx status
systemctl status nginx
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2021-08-06 15:04:33 CST; 4min 10s ago
Docs: http://nginx.org/en/docs/
Process: 2099 ExecStop=/bin/sh -c /bin/kill -s TERM $(/bin/cat /var/run/nginx.pid) (code=exited, status=0/SUCCESS)
Process: 2131 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 1498 (code=exited, status=0/SUCCESS)
Aug 06 15:04:33 localhost.localdomain systemd[1]: Starting nginx - high performance web s.....
Aug 06 15:04:33 localhost.localdomain nginx[2131]: nginx: [warn] the "ssl" directive is d...:5
Aug 06 15:04:33 localhost.localdomain nginx[2131]: nginx: [emerg] cannot load certificate...e)
Aug 06 15:04:33 localhost.localdomain systemd[1]: nginx.service: control process exited, ...=1
Aug 06 15:04:33 localhost.localdomain systemd[1]: Failed to start nginx - high performanc...r.
Aug 06 15:04:33 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Aug 06 15:04:33 localhost.localdomain systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
The first method: we find that the port is occupied, and use the command to view the process of the occupied port: netstat – anltp | grep eighty
View the occupied process number Then kill – nine Process number Restart after killing the process
The second method: we may have configuration errors when modifying the/etc/nginx/conf.d/default.conf or/etc/nginx/nginx.conf file. Recheck the editing. If we really can’t find the error, we can enter the error log of nginx to check: Tail – F/var/log/nginx/error.log Specific modifications can be made according to the error file of nginx
Read More:
- [Solved] docker Startup Error: Job for docker.service failed because the control process exited with error code
- [Solved] Job for network.service failed because the control process exited with error code. See “systemctl st
- [Solved] FTP Setup Error: Job for vsftpd.service failed because the control process exited with error code…
- [Solved] Job for docker.service failed because the control process exited with error code. After changing the docker configuration
- Nginx Startup Error: “/var/run/nginx/nginx.pid” failed” [How to Solve]
- Virtual machine failed to start network service error: ob for network.service failed because the control process exited with error code
- [Solved] Linux Service Start Error: *.service: Main process exited, code=exited, status=203/EXEC
- [Solved] nginx: [error] open() “/usr/local/nginx/nginx.pid” failed (2: No such file or directory)
- Nginx error: nginx: [error] invalid PID number ““ in “/run/nginx.pid“
- [Solved] Nginx Restart Error: /run/nginx.pid failed (2: No such file or directory)
- Nginx Error: Swap file “/etc/nginx/.nginx.conf.swp“ already exists
- Nginx Error: nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /project/api/nginx.conf:
- Restart and stop of nginx in Linux service
- Job for network.service failed [How to Solve]
- [Solved] Nginx Startup Error: directive is not allowed here in
- [Solved] mongo Startup Error: ERROR: child process failed, exited with error number 1
- Nginx realizes the same background service for portal and business
- nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
- Nginx Error: [emerg] bind() to [::]:80 failed (98: Address already in use)
- Solve the problem of 404 Not Found error in nginx accessing dynamic interface