apache - 来自 Apache 的虚拟主机是不同的域/目录,但只能首先使用

标签 apache virtual-hosts

我已经配置了两个虚拟主机 cuckoo.netfb.core.net位于本地 IP 地址 (127.0.0.1)

但是当我访问第二个域时: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>

最佳答案

将 fb.core.net 添加到 ServerAlias

<VirtualHost *:80>
    DocumentRoot "d:/_Devs/fbcore/public"
    ServerName fb.core.net
    ServerAlias www.fb.core.net fb.core.net # you can add more than one here
    SetEnv APPLICATION_ENV "development"
    <Directory d:/_Devs/fbcore/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

关于apache - 来自 Apache 的虚拟主机是不同的域/目录,但只能首先使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7788997/

相关文章:

java - 如何输出缓存文件并进行自定义日志记录 - jboss/java 项目

linux 上的 php apache

apache - 需要帮助设置 : Apache Reverse Proxy

macos - VirtualHosts 不适用于 Mac OS 10.7

tomcat - 在 ubuntu linux 12.10 上创建虚拟主机

apache - SSL 证书和 Apache 虚拟主机

Tomcat 7(虚拟主机?)

apache - htaccess If ... Else始终选择Else

apache - 本地主机上的 htaccess 指的是根目录,而不是文件夹

linux - WebSVN权限问题