我需要修改文件/etc/httpd/conf.d/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/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<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
Allow from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
当我进入 phpmyadmin 网页时,在收到错误消息之前没有提示我输入用户名和密码:Forbidden: You don't have permission to access /phpmyadmin on this server
. 我的系统是 Fedora 20
查看您的 httpd 错误日志,看看它是否有关于拒绝的更具体信息:/var/log/httpd/error_log
此外,如果 selinux 正在执行,请尝试将其关闭以进行测试:
与 /var/www/html 相比,查看您在 /usr/share/phpMyAdmin 上的权限
总有 d'oh!也检查一下...您是否在添加该配置后实际上重新启动/重新加载了网络服务器?
添加
Allow from 10.10.10.10
(替换10.10.10.10
为您的 IP 地址),不要忘记重新启动 apacheservice httpd restart
)。随意看看我的我把它上传到pastebin:http://pastebin.com/hvU3SGs1(第24、42行)。编辑文件:
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
并将您的文件替换为以下内容:重启阿帕奇:
service httpd restart
(phpMyAdmin v4.0.10.8)
这是我的 phpmyadmyn.comf
您没有提到您是否已经配置
.htaccess
了文件以进行身份验证。你也应该发布它的内容。您需要将它放在
/usr/share/phpMyAdmin
目录下,并且可以包含类似的内容:此外,您还需要
DirectoryIndex index.php
在目录块中有该行。您只需要自定义您的
<Directory "/usr/share/phpMyAdmin/">
部件和 .htaccess 文件。为了安全起见,您可以保留其余部分。在此处查看详细的操作方法:如何在 CentOS 7 服务器上使用 Apache 安装和保护 phpMyAdmin