简体   繁体   English

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

[英]Wampserver can't get Named Virtual hosts to work

Using wampserver I can't get named virtual hosts to work. 使用wampserver,我无法使命名的虚拟主机正常工作。 I've edited the httpd.conf to use the 我已经编辑了httpd.conf以使用

Include conf/extra/httpd-vhosts.conf

I've added the domain to my system32/driver/etc/hosts file. 我已经将该域添加到了system32 / driver / etc / hosts文件中。 I've edited the httpd-vhosts.conf file and everything seems to work except now localhost is unavailable. 我已经编辑了httpd-vhosts.conf文件,并且一切似乎都可以正常工作,除了现在本地主机不可用。 The domain I setup (test123.com) works fine, hitting 127.0.0.1 works fine, but hitting localhost hangs. 我设置的域(test123.com)正常,按127.0.0.1正常,但按localhost挂起。 There is nothing relevant in the error logs and no mention of it in the access logs. 错误日志中没有任何相关内容,访问日志中也没有提及。 Here is how I have edited httpd-vhosts.conf: 这是我编辑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>

What am I doing wrong? 我究竟做错了什么?

Finally figured it out. 终于想通了。 In httpd.conf I had to change 在httpd.conf中,我必须进行更改

Listen 80

to

Listen *:80

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM