有時候,可能stop的時候關閉不到一些進行所佔的端口,這個時候啟動也會報告端口被佔用。
如下圖:
[root@ZTE_OPLUS_1 nginx-1.12.0]# sh run.sh =============================================================================== HOME=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 _NGINXCMD=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0/sbin/nginx =============================================================================== /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 @WORK_DIR@ /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 @C_CMD@ nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:443 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:443 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:443 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:443 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:443 failed (98: Address already in use) nginx: [emerg] still could not bind()
上圖報443埠被佔用:使用fuser -n tcp指令查看佔用該連接埠的PID清單
fuser -n tcp 443
看看是什麼被佔用,也可以用netstat -ntpl看看誰佔用,然後KILL掉佔用的PID
#[root@ZTE_OPLUS_1 nginx-1.12.0]# fuser -n tcp 443 443/tcp: 2330 2337 2338 2339 2340 2341
使用kill -9 PID刪除程序
[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2330 [root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2337 [root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2338 [root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2339 [root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2340
#然後啟動即可
[root@ZTE_OPLUS_1 nginx-1.12.0]# sh run.sh =============================================================================== HOME=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 _NGINXCMD=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0/sbin/nginx =============================================================================== /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 @WORK_DIR@ /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0 @C_CMD@
更多Nginx相關技術文章,請訪問Nginx使用教程欄位進行學習!
以上是nginx啟動的時候提示埠被佔用怎麼解決辦法的詳細內容。更多資訊請關注PHP中文網其他相關文章!