Linux

在 Centos 7 上安裝 Apache

  • August 4, 2016

我目前正在嘗試使用以下教程在 Centos 7 上安裝 Apache https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos -7

當我輸入以下命令systemctl start httpd.service啟動 Apache 時,我收到以下錯誤:Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

誰能幫我理解這裡出了什麼問題?還請記住,在伺服器和 linux 方面,我是一個完全的菜鳥,因為我以前從未使用過它們。

我也輸入了以下命令systemctl status httpd.service並得到了以下資訊:

httpd.service - The Apache HTTP Server
  Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Thu 2016-08-04 10:39:59 IST; 3min 20s ago
    Docs: man:httpd(8)
          man:apachectl(8)
 Process: 6515 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
 Process: 6513 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 6513 (code=exited, status=1/FAILURE)

Aug 04 10:39:59 localhost.localdomain httpd[6513]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Aug 04 10:39:59 localhost.localdomain httpd[6513]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Aug 04 10:39:59 localhost.localdomain httpd[6513]: no listening sockets available, shutting down
Aug 04 10:39:59 localhost.localdomain httpd[6513]: AH00015: Unable to open logs
Aug 04 10:39:59 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 04 10:39:59 localhost.localdomain kill[6515]: kill: cannot find process ""
Aug 04 10:39:59 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 04 10:39:59 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Aug 04 10:39:59 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Aug 04 10:39:59 localhost.localdomain systemd[1]: httpd.service failed.

如果有任何幫助。

地址已在使用中:AH00072:make_sock:無法綁定到地址

$$ :: $$:80 / 0.0.0.0:80

另一個程序已經在偵聽預設的 HTTP 埠,即埠 80,因此 Apache 無法使用它並且無法啟動。調查以下命令可能有用的內容:

sudo netstat -tnlp | grep :80

或者

ss -tnlp | grep :80

引用自:https://serverfault.com/questions/794807