尝试设置vhost并确定我做错了什么。如果我运行apachectl,我会收到此警告。
$ sudo apachectl -t
httpd: Could not reliably determine the server's fully qualified domain name, using Johns-MacBook-Pro.local for ServerName
[Tue Apr 16 21:34:01 2013] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
Syntax OK
所以发生的事情是一切都恢复到顶级虚拟主机。这是我的vhost文件
<VirtualHost *:80>
DocumentRoot "/Users/jcostanzo/development/impress"
ServerName impress.local
ServerAlias impress.local
ErrorLog "/private/var/log/apache2/impress.local-error_log"
<Directory "/Users/jcostanzo/development/impress" >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/jcostanzo/development/testsomething"
ServerName testing.local
ServerAlias testing.local
ErrorLog "/private/var/log/apache2/test.local-error_log"
<Directory "/Users/jcostanzo/development/testsomething" >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
答案 0 :(得分:0)
第一次警告
httpd: Could not reliably determine the server's fully qualified domain name, using Johns-MacBook-Pro.local for ServerName
你得到了,因为你还没有定义服务器名称。在/private/etc/apache2/httpd.conf中轻松定义:
ServerName localhost
您的主机名是localhost,您将不再收到此警告。这里有更多信息:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
第二个警告:
[Tue Apr 16 21:34:01 2013] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
可能因为您缺席而出现
NameVirtualHost *:80
您的vhosts文件中的。您编辑了标准的
/private/etc/apache2/extra/httpd-vhosts.conf文件吗?使用
ServerAlias的
ServerName和
NameVirtualHost *:80
<VirtualHost *:80>
ServerName impress.local
ServerAlias www.impress.local
DocumentRoot "/Users/jcostanzo/development/impress"
ErrorLog "/private/var/log/apache2/impress.local-error_log"
<Directory "/Users/jcostanzo/development/impress" >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName testing.local
ServerAlias www.testing.local
DocumentRoot "/Users/jcostanzo/development/testsomething"
ErrorLog "/private/var/log/apache2/test.local-error_log"
<Directory "/Users/jcostanzo/development/testsomething" >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
使用相同的网址,使用此配置再试一次也有点奇怪,它应该有效:
apachectl -S
运行
{{2}},看看apache是否接受您的配置。