首次接觸nginx,安裝完使用命令 service nignx restart 后,出現這個錯誤,並按照提示給出的命令查看錯誤詳情 systemctl status nginx.service :
從詳情可以看到: (98:address already in use),說明端口已經被占用了,我們來看下是什么東西占用了端口吧:
輸入命令: netstat -apn|grep :80
可以看到13929/httpd服務占用了80端口,需要將這個服務關閉,(我嘗試使用kill殺死進程,但是無效)
執行命令: service httpd stop 來關閉httpd服務
然后再重啟niginx就能啟動了: