我需要运行虚拟服务器并且我取消注释包含“conf / extra / httpd-vhosts.conf”我一旦这样做并重新启动Wamp,它就会给我“请求的URL /在此服务器上找不到”错误。当我再次添加评论时,它会起作用。
我甚至尝试编辑驱动程序并添加了拥有虚拟主机的所有必要步骤。
服务器配置 Windows 10。 Apache / 2.4.9(Win32)PHP / 5.5.12服务器在localhost端口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>
答案 0 :(得分:0)
感谢您将配置文件的内容添加到问题中。鉴于情况如下:在那里定义了两个虚拟主机,第一个将被视为“默认主机”,因此主机配置将与不匹配的所有传入请求相关在特定的定义的http主机上。
默认主机将DocumentRoot定义为:c:/Apache24/docs/dummy-host.example.com
。因此,如果您收到上述错误消息,那么很可能在该文件夹中没有定义内容......