WAMP权限设置-Apache:You don't have permission to access / on this server. 96 作者 Wing_Li 关注 2016.06.12 1

转自:http://www.jianshu.com/p/a09c755f66d8

WAMP权限设置-Apache:You don't have permission to access / on this server.

96 
作者  Wing_Li 
2016.06.12 11:24*  字数 484  阅读 1344 评论 4

如果本文帮助到你,本人不胜荣幸,如果浪费了你的时间,本人深感抱歉。
希望用最简单的大白话来帮助那些像我一样的人。如果有什么错误,请一定指出,以免误导大家、也误导我。
本文来自:http://www.jianshu.com/users/320f9e8f7fc9/latest_articles
感谢您的关注。



WAMP官网:
http://www.wampserver.com/#download-wrapper

写在最前面:
在网上写这个教程的一大片大片的,之所以还要写的原因是,我按照网上说的配置了,可是还是没有成功,我也是纳闷了很久,最后发现少了最后一步,也就是本篇的第三步。所以在此留以记录、分享。

总步骤:

  1. 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,添加权限;
  2. 修改 D:\wamp\bin\apache\apache2.4.9\conf \ 路径下的 httpd.conf 文件,加载虚拟 hosts
  3. 修改 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就可以了。

<think>好的,我现在需要帮用户解决在Windows上配置WampServer时访问phpMyAdmin出现权限问题,具体是访问http://localhost:8080/phpmyadmin/时提示“You don't have permission access”。首先,我得回忆一下常见的可能原因和解决方法。 首先,用户提到使用的是8080端口,可能WampServer默认端口被占用,所以用户改成了8080。但问题出在权限上,所以需要检查Apache的配置是否正确,尤其是关于phpMyAdmin目录的访问权限。 接下来,可能的步骤包括检查Apache的httpd.conf或extra/httpd-vhosts.conf文件中的Directory配置是否正确,确保AllowOverride和Require指令设置得当。另外,可能需要检查phpMyAdmin目录的.htaccess文件是否存在或是否有冲突的规则。 另外,防火墙或安全软件有时会拦截本地请求,需要暂时禁用测试。还有可能是文件权限问题,即phpMyAdmin文件夹的权限是否允许Apache进程读取,可能需要调整文件夹的安全权限。 还有可能用户配置了虚拟主机,但未正确设置,导致权限问题。需要检查虚拟主机的配置,确保DocumentRoot和Directory指向正确的位置,并且有适当的访问权限。 此外,端口监听是否正确,Apache是否在监听8080端口,可以通过netstat命令检查端口占用情况,确保Apache确实在运行在8080端口上。 最后,可能需要重启所有Wamp服务,或者清除浏览器缓存,有时缓存会导致旧配置被保留,出现错误。 总结下来,可能的解决步骤是: 1. 检查Apache配置文件中的Directory权限设置。 2. 验证phpMyAdmin的目录路径是否正确。 3. 检查虚拟主机配置(如果有的话)。 4. 确认Apache监听端口是否正确配置为8080。 5. 检查文件夹权限,确保Apache用户有访问权限。 6. 检查.htaccess文件是否存在问题。 7. 关闭防火墙或安全软件测试。 8. 重启Wamp服务并清除浏览器缓存。 需要逐步指导用户完成这些检查,确保每一步都正确配置。同时,提醒用户备份配置文件,避免误操作导致其他问题。</think>在Windows中配置WampServer时出现`You don't have permission to access /phpmyadmin/`错误,通常与Apache权限配置或端口设置相关。以下是逐步解决方案: --- ### **1. 确认Apache监听端口** 若你手动修改了默认端口(如改为8080): 1. 打开WampServer安装目录下的配置文件: `\wamp\bin\apache\apache2.x.x\conf\httpd.conf` 2. 搜索`Listen 80`并改为`Listen 8080` 3. 保存文件后**重启所有Wamp服务** --- ### **2. 检查Apache权限配置** #### **修改`httpd.conf`文件** 1. 在`httpd.conf`中搜索以下内容: ```apache <Directory "c:/wamp/www/"> Options Indexes FollowSymLinks AllowOverride All Require local </Directory> ``` 2. 确保`Require local`存在(允许本地访问),若需允许局域网访问可改为`Require all granted` #### **检查phpMyAdmin专用配置** 1. 打开`\wamp\alias\phpmyadmin.conf` 2. 确认配置包含以下内容: ```apache <Directory "c:/wamp64/www/phpmyadmin/"> Options Indexes FollowSymLinks AllowOverride All Require local </Directory> ``` --- ### **3. 验证虚拟主机配置(如已启用)** 若使用了虚拟主机: 1. 打开`\wamp\bin\apache\apache2.x.x\conf\extra\httpd-vhosts.conf` 2. 检查是否包含类似配置: ```apache <VirtualHost *:8080> DocumentRoot "c:/wamp/www/phpmyadmin" ServerName localhost <Directory "c:/wamp/www/phpmyadmin"> AllowOverride All Require local </Directory> </VirtualHost> ``` --- ### **4. 检查文件夹权限** 1. 右键点击`phpmyadmin`文件夹(默认位于`\wamp\www\phpmyadmin`) 2. 选择**属性 > 安全 > 编辑** 3. 确保`SYSTEM`和`Administrators`用户组有**完全控制权限** --- ### **5. 清除缓存并重启服务** 1. 关闭所有Wamp服务,选择**以管理员身份运行**重新启动 2. 清除浏览器缓存或尝试无痕模式访问: `http://localhost:8080/phpmyadmin` --- ### **6. 其他可能性** - **防火墙拦截**:临时关闭Windows Defender或第三方防火墙测试 - **端口冲突**:运行`netstat -ano | findstr :8080`检查端口占用 - **.htaccess冲突**:临时重命名`phpmyadmin`目录下的`.htaccess`文件 --- 通过以上步骤,90%的权限问题可解决。若问题持续,建议检查WampServer错误日志: `\wamp\logs\apache_error.log` 或 `\wamp\logs\error.log` 中的具体错误信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值