AH00072: make_sock: 无法绑定地址 [::]:80 (13) 权限不够

6

升级到 macOS Sierra 后,我的 apache 无法启动。

在哪里可以找到 apache 的 error_log

AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist

AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist

AH00557: httpd: apr_sockaddr_info_get() failed for username.local

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message (13)Permission denied:

AH00072: make_sock: could not bind to address [::]:80 (13)Permission denied: 

AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down*

我已经按照这些说明尝试了,但并没有成功:http://digitalshore.io/local-web-development-environment-apache-macos-sierra-10-12/


1
对于 httpd-vhosts.conf 中的前两个注释,设置虚拟主机的虚拟主机。 对于第三个和第四个,请取消注释 ServerName 并在 httpd.conf 中分配值,例如:ServerName local_server:80,并将相同的值添加到 /etc/hosts 以通过服务器名称访问。 - Naga Penmetsa
对我来说,我只有前两个错误;@NagaPenmetsa的答案为我解决了这个问题。 - prateek31
4个回答

13

前两个注释中的主机设置在

httpd-vhosts.conf

对于第3,4个,取消ServerName的注释并分配值到

httpd.conf

例如:ServerName local_server:80

并将相同的值添加到/etc/hosts以通过服务器名称访问。

第5,6个,因为端口80被其他应用程序使用

sudo lsof -i:80


我遇到了类似的错误。这是我的 Stack Overflow 链接 - https://dev59.com/tlcP5IYBdhLWcg3w9-na 。有任何想法是什么导致了这种奇怪的行为吗? - Suresh

1

"apr_sockaddr_info_get()"被解决了,通过将localhost添加为ServerName。 - Raviranjan Mishra

1
AH00558: httpd:无法可靠地确定服务器的完全限定域名。 您需要通过以下方式识别Apache配置文件httpd.conf
apachectl -t -D DUMP_INCLUDES

然后编辑它并取消注释带有ServerName的行(确保它具有有效的服务器名称)。例如:

ServerName localhost

AH00072: make_sock: 无法绑定到地址 [::]:80 (13) 权限不够

您需要以 root 用户身份启动 Apache 服务,否则进程没有权限绑定到端口 80,因为所有低于 1024 的端口都需要管理员权限。

所以您需要运行以下命令:

sudo apachectl start

0
在我的情况下,问题得到解决是通过添加以下内容:
127.0.0.1       MacBook-Air-de-xxxxxx.local

/etc/hosts文件中。

要查找计算机的确切名称,请在共享设置中检查:

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接