無法在 Linux Mint 上重新啟動 apache

無法在 Linux Mint 上重新啟動 apache

Linux Mint 是 Virtual Box 上的訪客系統

Windows 8.1 是主機系統

danko@danko-VirtualBox ~ $ sudo /etc/init.d/apache2 restart

[sudo] password for danko: 

 Restarting web server apache2                           
 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

AH00015: Unable to open logs

Action 'start' failed.

Apache 錯誤日誌可能包含更多資訊。 [失敗] apache2 實例在 20 秒內未啟動。請閱讀日誌檔以發現問題

Apache 錯誤日誌為空

danko@danko-VirtualBox ~ $ netstat -punta | danko@danko-VirtualBox grep 聽

(並非所有進程都能被識別,非擁有的進程資訊將不會顯示,您必須是 root 才能看到全部。)

tcp        0      0 0.0.0.0:139             0.0.0.0:*            LISTEN      -               
tcp        0      0 0.0.0.0:80              0.0.0.0:*            LISTEN      -               
tcp        0      0 127.0.1.1:53            0.0.0.0:*            LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*            LISTEN      -               
tcp        0      0 0.0.0.0:445             0.0.0.0:*            LISTEN      -               
tcp6       0      0 :::139                  :::*                 LISTEN      -               
tcp6       0      0 :::80                   :::*                 LISTEN      -               
tcp6       0      0 ::1:631                 :::*                 LISTEN      -               
tcp6       0      0 :::445                  :::*                 LISTEN 

答案1

Apache 無法啟動,因為連接埠 80 已被其他進程使用(如 的輸出所證實netstat)。執行以下命令來查看該進程是什麼:

sudo lsof -i | grep "http (LISTEN)"

一旦確定了該進程是什麼,您就可以(乾淨地)停止它,然後啟動 Apache。

答案2

它可能作為服務安裝並需要重新啟動:

$ sudo 服務 apache2 重新啟動

相關內容