取消注释时 wamp 服务器不工作 "Include conf/extra/httpd-vhosts.conf"

wamp server not workning when uncomment "Include conf/extra/httpd-vhosts.conf"

我需要 运行 虚拟服务器,我取消了对 Include "conf/extra/httpd-vhosts.conf" 的注释,一旦我这样做并重新启动 Wamp,它就会给我 "The requested URL / was not found on this server" 错误。当我再次添加评论时它起作用了。

我什至尝试编辑驱动程序并添加所有必要的步骤来拥有虚拟主机。

服务器配置 Windows10。 Apache/2.4.9 (Win32) PHP/5.5.12 服务器位于本地主机端口 80

httpd-vhosts.conf 文件的内容:-

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

感谢您将配置文件的内容添加到问题中。鉴于情况如下:其中定义了两个虚拟主机,第一个将被视为 "default host",因此主机配置将与所有传入的请求相关,这些请求可以 而不是 [=16] =] 在特定定义的 http 主机上匹配。

该默认主机将 DocumentRoot 定义为:c:/Apache24/docs/dummy-host.example.com。因此,如果您收到上述错误消息,则很可能该文件夹中没有定义任何内容...