Wampserver无法使命名虚拟主机工作

时间:2011-09-20 20:52:16

标签: windows apache wampserver

使用wampserver我无法使命名虚拟主机工作。我编辑了httpd.conf以使用

Include conf/extra/httpd-vhosts.conf

我已将域添加到system32 / driver / etc / hosts文件中。我编辑了httpd-vhosts.conf文件,除了现在localhost不可用外,一切似乎都有效。我设置的域名(test123.com)工作正常,命中127.0.0.1工作正常,但命中localhost挂起。错误日志中没有任何相关内容,并且在访问日志中没有提及它。以下是我编辑httpd-vhosts.conf的方法:

#
# Virtual Hosts
#

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost *:80>
    ServerName localhost 
    DocumentRoot "C:/wamp/www"
    <Directory "C:/wamp/www">
        Options FollowSymLinks 
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
    DirectoryIndex index.php 
</VirtualHost>

<VirtualHost *:80>
    ServerName test123.com
    ServerAlias *.test123
    # Folder where the files live
    DocumentRoot "D:/Projects/html/test123"
    # A few helpful settings...
    <Directory "D:/Projects/html/test123">
        Options FollowSymLinks 
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
    DirectoryIndex index.php
</VirtualHost>

我做错了什么?

1 个答案:

答案 0 :(得分:0)

终于明白了。在httpd.conf中我不得不改变

Listen 80

Listen *:80
相关问题