![CentOS phpmyadmin 文件夹被禁止](https://linux22.com/image/1520692/CentOS%20phpmyadmin%20%E6%96%87%E4%BB%B6%E5%A4%B9%E8%A2%AB%E7%A6%81%E6%AD%A2.png)
安装了 php5、apache2、LAMP、PHPMyAdmin,但如果我像这样输入我的 IP 和 PHPMyAdminhttp://__my_IP__/phpmyadmin显示错误
禁止
您无权访问此服务器上的 /PHPMyAdmin/。
我编辑了/etc/httpd/conf.d/phpmyadmin.conf此文件还添加了我的 IP 地址并允许我的 IP 地址,但仍然显示上述错误,
我的 phpmyadmin.conf 文件现在是这样的
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 27.34.248.3
#Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
我如何访问 PHPMyAdmin 文件夹,以便轻松管理数据库,我正在使用 Redhat Linux 7.3,所有软件包都已更新!
请帮我!
答案1
这有效。Centos 7。
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
</IfModule>
</Directory>
答案2
尝试以下配置:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
Require ip 27.34.248.3
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Allow from 27.34.248.3
</IfModule>
</Directory>
重新启动 Apache 服务:
systemctl restart httpd
答案3
您需要更改 phpmyadmin 的 apache 配置文件
位置是 /etc/httpd/conf.d/phpMyAdmin.conf
默认配置是:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
更改为:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
</IfModule>
</Directory>
并使用命令重新启动 apache
# service httpd restart
或者
# systemctl restart httpd.service