Apache提示You don't have permission to access / on this server怎么解决?
程序员文章站
2022-05-18 23:39:40
...
Apache提示You don't have permission to access / on this server问题的解决
测试时遇到将一本地目录设置为一apache的虚拟主机,在httpd-vhosts.conf文件中进行简单设置,然后在hosts文件中将访问地址指向本地,启动apache,进行访问,却出现了You don’t have permission to access / on this server
的提示。
baidu了一下,原来是因为我的虚拟主机目录为非apache安装目录下的htdocs,所以违反了apache对默认对网站根访问权限。
apache的默认虚拟主机根目录地址为…/Apache Software Foundation/Apache2.2/htdocs 目录下,需要对httpd.conf文件进行修改才能指向其他目录。
在httpd.conf文件下找到这段:
DocumentRoot "C:/Program Files/Apache24/htdocs"
上面这个地址是你服务器的根目录
接下来为你的根目录配置访问权限
<Directory "C:/Program Files/Apache24/htdocs"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
然后重启apache,就ok了。
如果要配置自己的根目录,则将DocumentRoot中的地址换为你自己的地址,并为给该目录相应权限。
更多相关知识,请访问 PHP中文网!!
上一篇: php简单的数据库连接类程序
推荐阅读
-
对于搭建网站中出现“You don't have permission to access this resource.”错误提示的解决思路
-
You don't have permission to access / on this server,Forbidden
-
CentOS7.0下安装Apache2.4.20版本,安装完成之后,报 You don't have permission to access / on this server.
-
wamp不能使用phpmyadmin,提示“You don't have permission to access /phpmyadmin/ on this server.”...
-
Apache启动后出现You don't have permission to access on this server的解决办法
-
apache出现You don't have permission to access / on thi_PHP教程
-
Apache出现 You don't have permission to access /phpmya
-
PHP错误:Forbidden You don't have permission to access / on this server.,permissiontoaccess
-
MAC上vhosts后You don't have permission to access / on this server.
-
apache出现You don't have permission to access / on thi