在 Centos 7 上安装 Apache

在 Centos 7 上安装 Apache

我目前正在尝试使用以下教程在 Centos 7 上安装 Apachehttps://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.

如果这些有帮助的话。

答案1

地址已在使用中:AH00072:make_sock:无法绑定到地址 [::]:80 / 0.0.0.0:80

另一个进程已在监听默认 HTTP 端口 80,因此 Apache 无法使用它,因此无法启动。要调查以下命令可能有用:

 sudo netstat -tnlp | grep :80

或者

 ss -tnlp | grep :80

相关内容