【问题标题】:Vhosts not working虚拟主机不工作
【发布时间】:2014-07-04 10:37:55
【问题描述】:

我有以下虚拟主机设置:

<VirtualHost *:80>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:\Apache24\htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost cake-photos.com:80>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:\Apache24\htdocs\cake-photos"
    ServerName cake-photos.com
    ServerAlias *.cake-photos.com
    <Directory "C:\Apache24\htdocs\cake-photos">
    Options Indexes FollowSymLinks
    AllowOverride all
Require ip 127.0.0.1
    </Directory>
</VirtualHost>

<VirtualHost fangwear.co.uk:80>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:\Apache24\htdocs\Fangwear 2014"
    ServerName fangwear.co.uk
    ServerAlias www.fangwear.co.uk
    <Directory "C:\Apache24\htdocs\Fangwear 2014">
    Options Indexes FollowSymLinks
    AllowOverride all
     #   Require all granted
Require ip 127.0.0.1
    </Directory>
</VirtualHost>

<VirtualHost manager.com:80>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:\Apache24\htdocs\Manager 2014"
    ServerName manager.com
    ServerAlias www.manager.com
    <Directory "C:\Apache24\htdocs\Manager 2014">
    Options Indexes FollowSymLinks
    AllowOverride all
    #    Require all granted
Require ip 127.0.0.1
    </Directory>
</VirtualHost>

似乎都不起作用,如果我尝试访问其中任何一个,我最终会被重定向到 cake-photos.com 虚拟主机。

我还需要能够访问其他内容,例如 localhost/phpmyadmin,但这不适用于此配置。

我哪里错了?

【问题讨论】:

    标签: apache .htaccess vhosts


    【解决方案1】:

    您是否设置了主机文件?在 Unix 系统 /etc/hosts 上?您是否重新启动了服务器?

    【讨论】:

    • 是:127.0.0.1 localhost 127.0.0.1 fangwear.co.uk 127.0.0.1 cake-photos.com 127.0.0.1 es.cake-photos.com 127.0.0.1 fr.cake-photos.com 127.0.0.1 de.cake-photos.com 127.0.0.1 pt.cake-photos.com 127.0.0.1 zh.cake-photos.com 127.0.0.1 ru.cake-photos.com 127.0.0.1 my.cake-photos.com 127.0.0.1 bd.cake-photos.com 127.0.0.1 in.cake-photos.com 127.0.0.1 ae.cake-photos.com 127.0.0.1 manager.com
    • 我打开了我的 httpd-vhosts.conf 文件,我的条目如下所示: 只有我的 IP,而在 ServerName 中是实际名称
    • 谢谢,似乎已经解决了!
    猜你喜欢
    • 2013-04-10
    • 2017-07-05
    • 2016-11-07
    • 2018-05-09
    • 2011-03-08
    • 2016-11-27
    • 2013-09-11
    相关资源
    最近更新 更多