将OSX更新为High Sierra后的Apache2问题

时间:2017-11-22 18:27:47

标签: apache web server dns apache2

本周我遇到了Apache的主要问题。在我更新到High Sierra之后,我的Mac上的开发环境停止了工作。我自己试了好几个小时但是找不到解决办法。

服务器版本:Apache / 2.4.29(Unix)

基本上发生了什么,每当我尝试重新启动apache时,我收到此消息:

AH00558: httpd: Could not reliably determine the server's fully 
qualified domain name, using 10.0.0.50. Set the 'ServerName' directive 
globally to suppress this message

我已经尝试了很多不同的方法来配置我的vhosts文件以及我的httpd配置,但是没有看到任何改进。

我的网站之前存在的文档根路径没有指向。找到它并将其指向正确的位置后,“It Works!”消息我每次都消失了,现在我只收到一条消息说

Not Found

The requested URL / was not found on this server.

无论我为DocumentRoot部分添加什么路径,都会发生此消息,因此我不确定真正的问题是什么。

另外,我将我的apache设置为使用localhost,但是它继续使用10.0.0.50作为它的首选IP。我之前从未见过这个IP,我对它的来源感到困惑。

TLDR:在更新到High Sierra之后,我遇到了很多关于apache的问题,试图卸载/重新安装。 Apache使用10.0.0.50作为IP,DocumentRoot似乎有问题,配置似乎搞砸了。

1 个答案:

答案 0 :(得分:1)

检查配置:

httpd -t

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.79. Set the 'ServerName' directive globally to suppress this message
Syntax OK

解决这个问题:

sudo vi /etc/apache2/httpd.conf

在:

ServerName www.example.com:80

后:

ServerName localhost

再次检查配置:

httpd -t

Syntax OK