![Apache2 地址已在使用中...无法绑定到地址 0.0.0.0:80(无法启动 apache)](https://linux22.com/image/1136783/Apache2%20%E5%9C%B0%E5%9D%80%E5%B7%B2%E5%9C%A8%E4%BD%BF%E7%94%A8%E4%B8%AD...%E6%97%A0%E6%B3%95%E7%BB%91%E5%AE%9A%E5%88%B0%E5%9C%B0%E5%9D%80%200.0.0.0%3A80%EF%BC%88%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%20apache%EF%BC%89.png)
尝试了其他答案中针对同一问题的一些方法。仍然无法解决。需要注意的一点是:我正在运行 gitlab-ctl。
有用信息:
balter@bcore:~$ grep -ri listen /etc/apache2
/etc/apache2/ports.conf:Listen 80
/etc/apache2/ports.conf: Listen 443
/etc/apache2/ports.conf: Listen 443
/etc/apache2/apache2.conf:# supposed to determine listening ports for incoming connections which can be
/etc/apache2/apache2.conf:# Include list of ports to listen on
/etc/apache2/sites-available/bac/gitlab-omnibus-apache24.conf.bac:# Note this config assumes unicorn is listening on default port 8080 and
/etc/apache2/sites-available/bac/gitlab-omnibus-apache24.conf.bac:# gitlab-workhorse is listening on port 8181. To allow gitlab-workhorse to
/etc/apache2/sites-available/bac/gitlab-omnibus-apache24.conf.bac:# listen on port 8181, edit /etc/gitlab/gitlab.rb and change the following:
/etc/apache2/sites-available/bac/gitlab-omnibus-apache24.conf.bac:# gitlab_workhorse['listen_network'] = "tcp"
/etc/apache2/sites-available/bac/gitlab-omnibus-apache24.conf.bac:# gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
/etc/apache2/sites-available/gitlab.conf.bac:# Note this config assumes unicorn is listening on default port 8080 and
/etc/apache2/sites-available/gitlab.conf.bac:# gitlab-workhorse is listening on port 8181. To allow gitlab-workhorse to
/etc/apache2/sites-available/gitlab.conf.bac:# listen on port 8181, edit /etc/gitlab/gitlab.rb and change the following:
/etc/apache2/sites-available/gitlab.conf.bac:# gitlab_workhorse['listen_network'] = "tcp"
/etc/apache2/sites-available/gitlab.conf.bac:# gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
/etc/apache2/sites-available/gitlab.conf.bac:#Listen 80
balter@bcore:~$ netstat -ntlp | grep 80
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN -
balter@bcore:/etc/apache2$ cat ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
balter@bcore:/etc/apache2$
答案1
如果你以超级用户身份运行“netstat”:
sudo netstat -tulpn | grep 80
这应该会显示正在使用端口 80 的进程,这可能会对您有所帮助。如果没有进一步的信息,听起来 Gitlab 可能已经在使用端口 80,在我的 Gitlab 安装中,它默认在端口 80 上使用 nginx。
您是否曾经重新安装过 Gitlab?查看 grep 输出中的“gitlab.conf.bac”文件,我猜您先使用 Apache 安装了 Gitlab,然后可能使用 nginx 重新安装了?
因此以 sudo 身份检查 netstat,我想这就是你的答案。