Apache2 無法透過重新啟動關閉連接

Apache2 無法透過重新啟動關閉連接

我正在使用 Apache2 運行 Debian Web 伺服器,並且重新啟動命令開始出現錯誤。

root@srv:~# service apache2 stop
Stopping web server: apache2.
root@srv:~# service apache2 start
Starting web server: apache2(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
 failed!

有時它實際上會毫無問題地重新啟動,但通常我必須先殺死所有 -9 apache2 。 Debian IRC 上的某人讓我檢查我的活動 apache2 連接,結果發現它們並沒有退出,而且有數十個連接保持打開狀態。我怎樣才能讓這些最終超時?

答案1

嘗試

lsof -i :80

然後殺死相關的PID。

相關內容