【问题标题】:phpMyAdmin SSL configurationphpMyAdmin SSL 配置
【发布时间】:2014-03-02 19:34:36
【问题描述】:

我有 2 个 MySQL 用户,一个普通的“tommy”和一个控制用户“tommy_ctl”
Apache httpd 2.4.7 在 9090 for http 和 9080 for https 上运行

phpMyAdmin (v4.1.6) config.inc.php 文件包含“tommy_ctl”的用户/密码
我以“tommy”身份登录 phpMyAdmin 主页

现在
a) 在 config.inc.php

$cfg['Servers'][$i]['ssl'] = false;  
$cfg['ForceSSL'] = false;

我可以登录

http://linuxboxA:9090/phpMyAdmin/index.php  
https://linuxboxA:9080/phpMyAdmin/index.php

b) 当我设置时

$cfg['Servers'][$i]['ssl'] = true; 

为什么

https://linuxboxA:9080/phpMyAdmin/index.php 

登录时出现错误?:

 #1043 Cannot log in to the MySQL server  
 Connection for controluser as defined in your configuration failed  

此 SSL 选项是否不适用于通过 Apache 进行通信?

c) 当我设置时

$cfg['Servers'][$i]['ssl'] = true;  
$cfg['ForceSSL'] = true;  

https 9080 url 需要很多秒才能打开

https://lnappd201.hphc.org:9080/phpMyAdmin/index.php  

然后登录就变成了

https://lnappd201.hphc.org/phpMyAdmin/index.php?token=23771cb3b3851979903c6eb233465fd8  

注意,重定向的 url 中没有端口号

还有,

http://lnappd201.hphc.org:9090/phpMyAdmin/index.php 

立即变为(无需任何登录)

https://lnappd201.hphc.org/phpMyAdmin/?SID  

当设置“ForceSSL”时,phpMyAdmin 显然不知道 apache SSL 在端口 9080,
那么 ForceSSL 选项是如何工作的呢?

我的意图是,即使 Apache 在两个端口上都运行,我希望 phpMyAdmin 使用 SSL 和 ForceSSL(到 Apache SSL)

【问题讨论】:

    标签: apache ssl phpmyadmin


    【解决方案1】:

    您可以重新清洗所有内容,而不是重新配置 Web 服务器,将您的 phpmyadmin 置于负载均衡器后面,例如nginx 将负责(根据 SSL 配置)将您的 http phpmyadmin 代理到 https 服务。

    【讨论】:

      【解决方案2】:

      $cfg['Servers'][$i]['ssl']用于web server and MySQL server之间的通信。

      $cfg['ForceSSL'] 应该强制你的web browser connection to phpMyAdmin to be over HTTPS

      如 ForceSSL 文档中所述,在某些配置中启用它(我怀疑可能会应用非标准 https 端口)将需要您设置 $cfg['PmaAbsoluteUri'] 以便 phpMyAdmin 知道要使用的端口。

      希望有帮助!

      【讨论】:

      • $cfg['ForceSSL']Deprecated since version 4.6.0: This setting is no longer available since phpMyAdmin 4.6.0. Please adjust your webserver instead.的文档中所述
      • 是的,但是您回答的这个问题和答案已经有将近六年的历史了,并且原始海报使用phpMyAdmin 4.1.6版明确指定。如果您对此有疑问,我认为发布一个新问题,其中包含有关您的特定问题的更多详细信息,这将比否决我的旧答案获得更好的结果。
      • 我只是想让来这里的人知道这个解决方案不再适用于较新的版本;因为这个问题在谷歌相关搜索的第一页。
      • 再次发表评论,因为这最近被另一位评论者重新访问...在 4.6.0 之后没有好方法来清理 phpMyAdmin 的这个答案;解决方案是正确配置网络服务器。在 4.6.0 之前,phpMyAdmin 强制连接以特定方式运行(特别适用于代理或 SSL 服务器或重新包装初始响应的其他解决方案)。从那时起,phpMyAdmin 不再试图强制网络服务器以特定方式运行,因此问题提出的条件不应该存在。如果4.6.0以后有类似问题,应该是新问题。
      猜你喜欢
      • 1970-01-01
      • 2011-05-20
      • 2013-09-04
      • 2014-08-26
      • 2012-10-24
      • 2014-08-17
      • 2014-03-24
      相关资源
      最近更新 更多