Apache 的虚拟主机是不同的域/目录,但仅首先使用
我已经配置了两个虚拟主机 cuckoo.net
和 fb.core.net
位于本地 IP 地址(127.0.0.1)
但是当我访问第二个域时: < code>fb.core.net,它总是返回第一个。
请考虑以下配置来帮助我,我真的不知道我在这里错了什么。
<VirtualHost *:80>
DocumentRoot "d:/_iLearning/iCuckoo"
ServerName cuckoo.net
ServerAlias www.cuckoo.net
SetEnv APPLICATION_ENV "development"
<Directory d:/_iLearning/iCuckoo>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "d:/_Devs/fbcore/public"
ServerName fb.core.net
ServerAlias www.fb.core.net
SetEnv APPLICATION_ENV "development"
<Directory d:/_Devs/fbcore/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I've configured two virtual host cuckoo.net
and fb.core.net
are located to local ip address (127.0.0.1)
But when I access the second domain: fb.core.net
, it always returns the first.
Please consider the below configuration to help me, I really don't know what I am wrong here.
<VirtualHost *:80>
DocumentRoot "d:/_iLearning/iCuckoo"
ServerName cuckoo.net
ServerAlias www.cuckoo.net
SetEnv APPLICATION_ENV "development"
<Directory d:/_iLearning/iCuckoo>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "d:/_Devs/fbcore/public"
ServerName fb.core.net
ServerAlias www.fb.core.net
SetEnv APPLICATION_ENV "development"
<Directory d:/_Devs/fbcore/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 fb.core.net 添加到
ServerAlias
Add fb.core.net to the
ServerAlias
我今天面临这个问题
请检查这个网址
http://alexking.org/blog /2007/11/01/apache-2-only-serves-first-virtual-host
我添加的配置
我认为您需要添加
或更改
到
我的配置
i face this issue today
please check this url
http://alexking.org/blog/2007/11/01/apache-2-only-serves-first-virtual-host
my config i add
i think you need to add
or change
<VirtualHost *:80>
to
<VirtualHost *>
My config