【问题标题】:Problem with the phpMyAdmin ssl configurationphpMyAdmin ssl 配置问题
【发布时间】:2020-01-24 22:09:37
【问题描述】:

我的 PhpMyAdmin (我使用 NGINX 和 PHP 7.2) 有一点问题。我想通过将其信息添加到config.inc.php 文件来配置 MySQL (MariaDB 10.2.27) 和 PhpMyAdmin 之间的 SSL 连接:

$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['ssl_key'] = '/etc/mysql/ssl/server-key.pem';
$cfg['Servers'][$i]['ssl_cert'] = '/etc/mysql/ssl/server-cert.pem';
$cfg['Servers'][$i]['ssl_ca'] = '/etc/mysql/ssl/ca-cert.pem';
$cfg['Servers'][$i]['ssl_ca_path'] = '/etc/mysql/ssl';

但是

现在当我想连接到 PhpMyAdmin 时出现错误:

mysqli_real_connect(): (HY000/2006): MySQL 服务器已经消失

你知道我为什么会出现这个错误吗?提前感谢您的帮助。

【问题讨论】:

  • $cfg['Servers'][$i]['ssl'] = false;在您的代码中将 true 更改为 false 可能会有所帮助
  • 这不是我正在寻找的解决方案,因为相反我希望激活 SSL。

标签: php mysql ssl phpmyadmin


【解决方案1】:

您可能误解了 pma 配置中的 ssl 选项。

这不会加密您的网络浏览器和 phpmyadmin 之间的流量,而是加密 phpmyadmin 和您的 mysql 服务器之间的连接,它必须在您的 mysql 服务器上设置。

并且您没有为HTTPS 设置 phpMyAdmin 的 SSL 证书 - 它是一个 Web 应用程序 - 不是 Web 服务器。 Nginx 存储证书并终止/解包 SSL。

您正在使用的HTTPS 会话位于您的 PC 和 Nginx 之间 - 它与 phpMyAdmin 无关。您的 phpMyAdmin 虚拟主机正在使用您在 Nginx 中定义的任何证书。

HTTPS != SSL 就 phpMyAdmin 的配置而言。

您提到的设置专门用于 phpMyAdmin 和 MySQL 之间的 SSL 连接 - 如果在 localhost 上,无论如何都不太相关。

毕竟这个问题应该转到:https://serverfault.com 你来错地方了。

查看更多:https://serverfault.com/questions/403006/phpmyadmin-with-ssl-https-and-mysql-client-on-nginx

【讨论】:

    猜你喜欢
    • 2014-03-02
    • 2014-08-17
    • 1970-01-01
    • 2018-04-01
    • 2021-05-06
    • 2015-11-18
    • 2014-09-02
    • 2015-05-27
    相关资源
    最近更新 更多