CentOS 6 phpMyAdmin访问被拒绝

我有问题与phpMyAdmin设置我的VPS。

我的错误消息:

Forbidden You don't have permission to access /phpMyAdmin/ on this server. 

我的phpMyAdminconfiguration:

  # 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 127.0.0.1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from All Allow from 127.0.0.1 </IfModule> </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 Deny from All Allow from 127.0.01 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 </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> 

我有127.0.0.1到我的公共IP,但仍然没有工作,

此外,我遵循: https : //www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-a-centos-6-4-vps

提前致谢!

 Require ip 127.0.0.1 

在你的情况下是错误的。 通过将对phpMyAdmin目录的访问仅限制在本地主机上,只有本地客户端(比如命令行或本地显示器上运行的firefox)将被授予访问此目录的权限。 如果您在VPS上运行此服务器,则可能希望限制较less,例如授予访问您的家庭IP地址(很可能是NAT路由器)或访问VPS的地方。

大多数人会做的是通过只允许通过一个SSL保护的链接(例如https://wiki.apache.org/httpd/NameBasedSSLVHosts )来保护他们的phpmyadmin访问,然后对目录有一个不太严格的限制,比如:

 Require group admin 

甚至完全放弃Apache身份validation

 Require all granted 

因为phpMyAdmin将接pipe它自己的基于mysql的authentication。

phpMyAdminconfiguration部分将如下所示:

 <IfModule mod_ssl.c> <VirtualHost _default_:443> SSLEngine on # SSLCertificateFile directive is needed. Note that you'd better do with creating your own # private certificates (see any openssl tutorial) and point at them here SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # additional trick: many robots try to access paths variants to myurl/phpmyadmin # a minor trick is to choose an entirely different alias to avoir their clogging your logs # with many break in attempts. Alias /mysqladmin /my/path/to/phpmyadmin <Directory "/my/path/to/phpmyadmin"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory>