Nginx Startup Error: Job for nginx.service failed because the control process exited with error code

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: