![CentOS phpmyadmin 資料夾被禁止](https://rvso.com/image/1520692/CentOS%20phpmyadmin%20%E8%B3%87%E6%96%99%E5%A4%BE%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
這有效。森托斯 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