添加多站点之后出现The requested URL / was not found on this server.没有添加多站点之前localhost能进去,加了之后就进不去了。
试了下。
在httpd-vhosts.conf中增加下面代码,直接用localhost就能访问。即把localhost也当成一个虚拟站点,其对应的目录即可访问。
<VirtualHost *:80>
DocumentRoot "F:/Demo"
ServerName localhost
</VirtualHost>
不知有没有其他方法?
我也遇到这个问题了。应该是“httpd-vhosts.conf”的事,但是不知道怎么改,大神给解答一下啊。
能告诉怎么解决的吗?我单个站点是可以的,一配置多个站点总是The requested URL / was not found on this server.
可以了 不错
大神 膜拜
厉害啊
如果想让127.0.0.1和localhost也能访问根目录的话如下
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/"
ServerName "localhost"
DirectoryIndex "index.php"
<Directory "D:/wamp/www/">
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/"
ServerName "127.0.0.1"
DirectoryIndex "index.php"
<Directory "D:/wamp/www/">
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
windows/system32/drivers/etc/host文件添加
127.0.0.1 localhost
这样就把localhost和127.0.0.1不能访问根目录的问题解决了
虚拟主机配置如下:
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/"
ServerName "127.0.0.1"
DirectoryIndex "index.php"
<Directory "D:/wamp/www/">
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
修改完成之后重启一下服务器就可以了!
还是不可以啊
配置多站点之前,我们是单站点,在配置之后,我们的多站点的配置覆盖了之前的单站点的配置,因此把之前那个也当做多站点的一部分配置一下,自然能正常访问了
修改什么才能让localhost也能正确地访问?
改了,刚换了个版本,很多地方都不用修改
windows host 有改吗
大神厉害,问题解决了
test01.com test02.com打开之后是外国网站
哪地方不对谁能给改下
DocumentRoot "F:/Demo"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "F:/Demo">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Allow from all
# Allow from 127.0.0.1
</Directory>