systemctl start 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 -t 检查没有问题
systemctl status nginx 查看nginx状态
显示报错为 80端口被占用
Jul 13 16:18:18 web01 nginx[2407]:nginx:[emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
出现此原因可能为
安装时 启动使用了 nginx命令启动,修改配置文件之后又使用 systemctl restart nginx命令启动
nginx命令启动时已将80端口占用,再使用systemctl restart nginx 又是跑到端口80 导致冲突报错
解决方法
查看nginx端口状态
ps -ef|grep nginx #查看nginx端口使用情况
将nginx进程ss
pkill nginx
再使用system方式启动
systemctl start nginx
方式启动
systemctl start nginx