我需要修改文件/etc/httpd/conf.d/phpMyAdmin.conf
以允许远程用户(不仅是本地主机)login
# 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网页时,在得到错误消息之前,我没有提示input用户名和密码: Forbidden: You don't have permission to access /phpmyadmin on this server
。 我的系统是Fedora 20
看看你的httpd错误日志,看看是否有关于拒绝的更具体的信息:/ var / log / httpd / error_log
另外,如果selinux正在执行然后尝试closurestesting:
$ sudo setenforce 0 $ getenforce
与/ var / www / html相比,查看/ usr / share / phpMyAdmin上的perms
$ ls -ld /usr/share/phpMyAdmin /var/www/html
总是有这个喔! 检查太…你真的重新启动/重新加载Web服务器后添加该configuration?
$ apachectl restart
Allow from 10.10.10.10
添加Allow from 10.10.10.10
(replace10.10.10.10
w /你的IP地址),别忘了重启apache service httpd restart
)。 随时来看看我上传它为您pastebin: http : //pastebin.com/hvU3SGs1 (24,42行)。
编辑文件: sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
并用下面的代码replace你的:
<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 </IfModule> </Directory>
重新启动Apache: service httpd restart
(phpMyAdmin v4.0.10.8)
这是我的phpmyadmyn.comf
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/" # to give access to phpmyadmin from outside # replace the lines # # Require local # # by # # Require all granted # <Directory "c:/wamp/apps/phpmyadmin4.1.14/"> Options Indexes FollowSymLinks MultiViews AllowOverride all <IfDefine APACHE24> Require all granted </IfDefine> <IfDefine !APACHE24> Order Deny,Allow Deny from all Allow from localhost ::1 127.0.0.1 </IfDefine> php_admin_value upload_max_filesize 128M php_admin_value post_max_size 128M php_admin_value max_execution_time 360 php_admin_value max_input_time 360 </Directory>
你没有提到,如果你已经configuration.htaccess
文件的身份validation工作。 你也应该发布它的内容。
你需要把它放在/usr/share/phpMyAdmin
目录下,并且可以包含类似的东西:
AuthType Basic AuthName "Restricted Files" AuthUserFile /etc/apache2/.phpmyadmin.htpasswd Require valid-user
另外你还需要在你的目录块中有DirectoryIndex index.php
这一行。
<Directory /usr/share/phpMyAdmin> Options FollowSymLinks DirectoryIndex index.php AllowOverride All [...]
您只需要自定义<Directory "/usr/share/phpMyAdmin/">
部分和.htaccess文件。 其余的你可以保持它的安全。
如何在CentOS 7服务器上安装和保护phpMyAdmin和Apache