启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

时间:2023-03-09 19:43:26
启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

首次接触nginx,安装完使用命令 service nignx restart  后,出现这个错误,并按照提示给出的命令查看错误详情  systemctl status nginx.service   :

  启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

从详情可以看到: (98:address already in use),说明端口已经被占用了,我们来看下是什么东西占用了端口吧:

输入命令:  netstat -apn|grep :80

启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

可以看到13929/httpd服务占用了80端口,需要将这个服务关闭,(我尝试使用kill杀死进程,但是无效)

执行命令:  service httpd stop   来关闭httpd服务

然后再重启niginx就能启动了:

启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.