解決nginx無法啟動的問題 埠被占用

2021-08-28 15:23:15 字數 1859 閱讀 9180

一段時間沒使用nginx後,發現無法啟動

問題:輸入nginx -tc /etc/nginx/nginx.conf顯示正常

但是輸入systemctl reload nginx提示

job for nginx.service invalid.
查錯:

輸入systemctl status nginx.service -l

提示

● 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 mon 2018-10-01 20:04:22 cst; 38s ago

docs:

process: 27162 execstart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/failure)

oct 01 20:04:19 vm_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: address already in use)

oct 01 20:04:20 vm_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: address already in use)

oct 01 20:04:20 vm_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: address already in use)

oct 01 20:04:21 vm_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: address already in use)

oct 01 20:04:21 vm_205_38_centos nginx[27162]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: address already in use)

oct 01 20:04:22 vm_205_38_centos nginx[27162]: nginx: [emerg] still could not bind()

oct 01 20:04:22 vm_205_38_centos systemd[1]: nginx.service: control process exited, code=exited status=1

oct 01 20:04:22 vm_205_38_centos systemd[1]: failed to start nginx - high performance web server.

oct 01 20:04:22 vm_205_38_centos systemd[1]: unit nginx.service entered failed state.

oct 01 20:04:22 vm_205_38_centos systemd[1]: nginx.service failed.

解決
vim /etc/nginx/conf.d/default.conf
更改listen的埠,因為原來的埠被占用( address already in use)

nginx無法啟動

nginx無法啟動,最常見的就是80埠被占用,可以用 netstat aon findstr 80 命令檢視。我遇到的並不是這樣,埠沒有占用,就是啟不來,後來才發現可以看日誌,好傻。目錄在logs error.log檔案。翻到最下邊可以看到錯誤資訊。2017 11 11 09 01 31 emerg...

解決mysql服務無法啟動的問題

今天,mysql突然無法啟動了。解決辦法記錄一下 1.刪除data檔案 我的 d program files mysql 5.7.19 winx64 c program files mysql mysql server 5.7 data 注意 這個檔案可能在你一直試圖操作之後,出現被占用,無法刪除的...

解決Docker安裝後無法啟動的問題

採用聯網yum方式安裝了docker,啟動docker systemctl start docker.service發現啟動不了,提示讓我檢視啟動狀態 systemctl status docker.service l 發現問題error的錯誤提示是 selinux和docker版本不匹配,錯誤訊息...