XAMPP WIndows VHOST始终指向localhost

时间:2017-02-09 22:23:20

标签: windows apache xampp vhosts

今天我尝试为我的新Web项目配置VHOST但我遇到了一个问题,我无法解决...甚至没有StackOverflow的帮助......

我配置了我的“httpd-vhosts.conf”,正如我现在阅读的许多教程中所提到的那样,并且也像教程中提到的那样设置我的主机文件......

我还检查了我的vhost文件是否包含在apache httpd.conf(它是)

所以这是我的配置:

VHOST:

NameVirtualHost *:80
<VirtualHost *:80> 
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@.testsite.dev
    DocumentRoot "C:\xampp\htdocs\Projekte\GamePlay_dev"
    ServerName gameplay.localhost
    ServerAlias www.gameplay.localhost
</VirtualHost>

主机:

127.0.0.1       localhost
127.0.0.1       gameplay.localhost

是的,我已经重启了我的服务器......我甚至重新启动了整个电脑,只是为了确保......

1 个答案:

答案 0 :(得分:0)

根据我的评论,这里有一个有效的vhosts: -

       $rsscreator = $dc->creator;

在局域网上的PC上,我有我的主机文件(注意有些是多余的,因为我运行两台apach一台不同的机器并且没有正确整理): -

#
# Virtual Hosts
#

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot c:/wamp/www
    <Directory  "c:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:80>
     DocumentRoot "C:/wamp/mt"
     ServerName www.mt.flnet.org
     <Directory  "C:/wamp/mt">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>
<VirtualHost *:80>
     DocumentRoot "C:/wamp/trishandmike"
     ServerName www.tandm.flnet.org
     <Directory  "C:/wamp/trishandmike">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>
<VirtualHost *:80>
     DocumentRoot "C:/wamp/Judggle"
     ServerName www.JudggleCopy.flnet.org
     <Directory  "C:/wamp/Judggle">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>
<VirtualHost *:80>
     DocumentRoot "C:/wamp/mjt"
     ServerName www.mjt.flnet.org
     <Directory  "C:/wamp/mjt">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>
<VirtualHost *:80>
     DocumentRoot "C:/wamp/ShopWise"
     ServerName www.ShopWise.flnet.org
     <Directory  "C:/wamp/ShopWise">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>

你有运行Apache的PC的静态IP地址吗?

另一个不同之处在于我使用的是WAMP。我知道提供的别名让我对WAMP的后期版本感到麻烦。检查您是否指向别名文件,例如类似主机文件中的# localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 192.168.1.2 www.trishandmike.flnet.org 192.168.1.2 www.AIPCStudentconnect.flnet.org 192.168.1.2 www.zonemike.flnet.org 192.168.1.2 www.tristen.flnet.org 192.168.1.2 www.csacalc.flnet.org 192.168.1.2 www.ocportal.flnet.org 192.168.1.2 www.flwgtest.flnet.org 192.168.1.2 www.judggle.flnet.org 192.168.1.2 www.mt.flnet.org # on 2nd box running later Apacahe etc 192.168.1.2 www.tandm.flnet.org # on 2nd box running later Apacahe etc 192.168.1.2 www.JudggleCopy.flnet.org 192.168.1.2 www.mjt.flnet.org 192.168.1.2 www.judgements.flnet.org 192.168.1.2 www.shopwise.flnet.org 。我想我从这里删除了一个有问题的文件。