WAMP权限设置-Apache:You don't have permission to access / on this server.
WAMP官网:
http://www.wampserver.com/#download-wrapper
写在最前面:
在网上写这个教程的一大片大片的,之所以还要写的原因是,我按照网上说的配置了,可是还是没有成功,我也是纳闷了很久,最后发现少了最后一步,也就是本篇的第三步。所以在此留以记录、分享。
总步骤:
- 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,添加权限;
- 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,加载虚拟 hosts
- 修改 D:\wamp\bin\apache\apache2.4.9\conf\extra\ 路径下的 httpd-vhosts.conf ,添加工作目录
1. 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,添加权限;
需要修改的地方,用注释标出,
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#======================================
#这里是我们的工作目录,默认是“/www”,可以自定义修改
#======================================
DocumentRoot "E:\PHPProject"
#
# 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 />
AllowOverride All
Require all denied
</Directory>
#======================================
#在上面修改完了之后,在这里也要修改(可以不做修改,也就是使用默认的)
#======================================
<Directory "E:\PHPProject">
#
# 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.4/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:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
Order Deny,Allow
Deny from all
Allow from all
#======================================
#修改这几个权限
#======================================
</Directory>
2. 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,加载虚拟 hosts
还是在刚刚的文件里, Ctrl + F 搜索 “httpd-vhosts”;
把 #Include conf/extra/httpd-vhosts.conf 的注释放开,也就是删除前面的 #
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3. 修改 D:\wamp\bin\apache\apache2.4.9\conf\extra\ 路径下的 httpd-vhosts.conf ,添加工作目录
在 httpd-vhosts.conf 文件的最后添加以下设置。
<VirtualHost _default_:80>
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "E:\PHPProject"
#ServerName www.example.com:80
</VirtualHost>
然后重启Apache就可以了。
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 时光·李记
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果