嗨,抱歉,这里的 Apache 和 Macs 的总菜鸟......感觉答案非常明显,但我一直在寻找多年没有成功
我在 /private/etc/apache2/extra/httpd-vhosts.conf 中有以下几行
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Library/WebServer/Documents/mfoe/"
ServerName mfoe.cycle
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
httpd.conf 文件包含 vhosts
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Run Code Online (Sandbox Code Playgroud)
那么为什么当我在终端中运行命令时: $ httpd -S 我得到:
httpd: Could not reliably determine the server's fully qualified domain name, using Alexs- MacBook-Air.local for ServerName
VirtualHost configuration:
Syntax OK
Run Code Online (Sandbox Code Playgroud)
看起来它没有在 vhosts 中读取任何内容。重新启动时出现此错误可能与此有关吗?
Alexs-MacBook-Air:/ alex$ httpd -k restart
httpd: Could not reliably determine the server's fully qualified domain name, using Alexs-MacBook-Air.local for ServerName
httpd not running, trying to …Run Code Online (Sandbox Code Playgroud)