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 | grep LISTEN

(すべてのプロセスを識別できるわけではなく、所有されていないプロセスの情報は表示されません。すべてを表示するには、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

ポート 80 がすでに他のプロセスによって使用されているため、Apache を起動できません ( の出力で確認済みnetstat)。そのプロセスを確認するには、次のコマンドを実行します。

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

そのプロセスが何であるかを判別したら、それを (正常に) 停止してから Apache を起動できます。

答え2

サービスとしてインストールされる場合があり、次のように再起動する必要があります。

$ sudo サービス apache2 を再起動します

関連情報