解决限制本机访问phpmyadmin

环境:

XAMPP for Linux 5.6.23

CentOS 6.5

IP:192.168.25.129

安装完XAMPP后,在浏览器中输入http://192.168.25.129/phpmyadmin/地址,出现下列提示:

Access forbidden!
  New XAMPP security concept:
  Access to the requested object is only available from the local network.
  This setting can be configured in the file "httpd-xampp.conf".
  If you think this is a server error, please contact the webmaster.
Error 403
  192.168.25.129
  Apache/2.4.18 (Unix) OpenSSL/1.0.2h PHP/5.6.23 mod_perl/2.0.8-dev Perl/v5.16.3

附截图,更直观点。

phpmyadmin 限制本机登录

按经验,编辑/httpd-xampp.conf,注释phpmyadmin目录中的Require local,保存后重启apache,应该就可以了,但这次无论如何就是不行。

在网上搜索大多都是提示注释Require local、或注释Deny from all,又或找到:

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">

将列表中的phpmyadmin删除,但/httpd-xampp.conf中除了存在Require local,其它均没有。也许是软件版本不同,所以处理方式不一样。

经摸索,尝试,终于解决,如果你碰到跟我一样的问题,也许可以试试:

使用vi 打开/httpd-xampp.conf,找到如下内容:

<Directory "/opt/lampp/phpmyadmin">
  AllowOverride AuthConfig Limit
  Require local
  ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

在Require local前加上#符号注释,然后在后面增加Require all granted,如:

<Directory "/opt/lampp/phpmyadmin">
  AllowOverride AuthConfig Limit
  # Require local
  Require all granted
  ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

保存后,重启apache服务,应该可以打开phpmyadmin页面了。

发表评论