解决Wamp 开启vhost localhost 提示 403 Forbbiden 的问题!

简介:

非常奇怪的一个问题。我曾经从来都没有这样过!訪问 http://localhost/ 提示  403 Forbbiden。


我之前的设置一直都是这种:

httpd.conf

<Directory />
    AllowOverride All
	Options Indexes FollowSymLinks
    Require all granted
</Directory>

extra/httpd-vhost.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "d:/localhost"
    ServerName localhost
    ServerAlias local
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>


<VirtualHost *:81>
    ServerAdmin webmaster@localhost
    DocumentRoot "d:/wamp/www"
    ServerName localhost81
    ServerAlias local81
    ErrorLog "logs/localhost81-error.log"
    CustomLog "logs/localhost81-access.log" common
</VirtualHost>

然后 d:/localhost/ 与  d:/wamp/www 文件夹下都没有索引文件(如 index.html index.php index.html)曾经訪问都是默认列出文件夹的,可是今天打开localhost 却提示403 无权限。

并且改动vhost ,调换 80 port和 81 port位置还是这样,百思不得其解!


强迫症。花费了一个下午的时间研究仍旧是没有头绪。晚上回到家里,偶然看到stackoverflow上的一个帖子,http://stackoverflow.com/questions/9110179/adding-virtualhost-fails-access-forbidden-error-403-xampp-windows-7,尝试着改动第一个VirtualHost,在里面增加 <Directory "d:/localhost"> ... </Directory> 重新启动Apache,能够了。


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "d:/localhost"
    ServerName localhost
    ServerAlias local
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
	<Directory "d:/localhost">
	Options Indexes
	Require all granted
	</Directory>
</VirtualHost>


可是我后来将这一段去掉,然后又重新启动,訪问 http://localhost 又变成能够訪问了。

等于我还原了全部改动,再去訪问localhost 却又不会出现提示 403 Forbbiden了!



并且我将httpd.conf 的<Directory /> ... </Directory>的这一段去掉Options Indexes 这一段,改成例如以下,再重新启动Apache:

<Directory />
    AllowOverride All
    Require all granted
</Directory>

我訪问 http://localhost/ 或者 http://localhost:81,文件夹还是能够列出来,出鬼了!。




觉得wamp 似乎有缓存,并且重新启动也无法清除?重装也是无法清除。

如今问题并没有再次重现,但假设您有彻底的解决方法,欢迎邮件交流。

by default.fu@foxmail.com








本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5265854.html,如需转载请自行联系原作者
相关文章
|
关系型数据库 MySQL 应用服务中间件
Centos中查看nginx、apache、php、mysql配置文件路径
Centos中查看nginx、apache、php、mysql配置文件路径
2159 0
WAMP localhost/phpmyadmin 无法进入
WAMP localhost/phpmyadmin 无法进入
WAMP localhost/phpmyadmin 无法进入
|
Web App开发 监控 关系型数据库
CentOS安装Awstats分析nginx日志并通过htpasswd认证访问
这篇笔记记录了在CentOS7.6中安装Awstats7.7,使用Awstats分析nginx日志,以及使用php+nginx搭建web管理界面,通过htpasswd认证访问的过程
3778 0
|
应用服务中间件 nginx
NGINX虚拟目录alias和root目录
  假设nginx配置的域名是www.kazihuo.com,现有静态资源/home/www/oye目录需要通过nginx访问。 1、在nginx.conf中到处第二行添加内容‘include /usr/local/nginx/conf/conf.
1600 0
|
Java 应用服务中间件 网络架构
|
关系型数据库 MySQL Apache
|
应用服务中间件 nginx