php - Problem with the phpMyAdmin ssl configuration
问题描述
I have a little problem with my PhpMyAdmin (i use NGINX & PHP 7.2). I wanted to configure the SSL connection between MySQL (MariaDB 10.2.27) and PhpMyAdmin by adding its information to the config.inc.php
file:
$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';
But
now when I want to connect to PhpMyAdmin I get the error:mysqli_real_connect(): (HY000/2006): MySQL server has gone away
Do you know why I have this error? Thank you in advance for your help.
解决方案
You might be misunderstanding the ssl options in the pma config.
This does not encrypt traffic between your web browser and phpmyadmin, but rather the connection between phpmyadmin and your mysql server and it has to be set up on your mysql server.
AND you don't set an SSL certificate for phpMyAdmin for HTTPS
- it is a web app - not a web server. Nginx stores the certificates and terminates/unwraps the SSL.
The HTTPS
session you are using is between your PC and Nginx - it is nothing to do with phpMyAdmin. Your phpMyAdmin vhost is using whatever certificate you defined in Nginx.
HTTPS
!= SSL
insofar as phpMyAdmin's configuration is concerned.
The setting you referred to is specifically for an SSL
connection between phpMyAdmin and MySQL - which if is on localhost, isn't all too relevant anyway.
After all this question should goto : https://serverfault.com you are in wrong place.
See more : https://serverfault.com/questions/403006/phpmyadmin-with-ssl-https-and-mysql-client-on-nginx
推荐阅读
- java - JPA ManToMany 关联并使用 Spring Data Repository 插入、检索数据
- javascript - 无法重新填充表单
- unit-testing - 有没有办法在 kdb+ 中进行宏单元测试?
- java - 当错误来自 Mono 的 zip 方法时对 doOnError 方法的单元测试
- php - PHP 回调:类的方法是否有 ::class 的等价物?
- ruby-on-rails - 构建失败(Ubuntu 20.04 使用 ruby-build 20210119)
- r - 如何在绘图点上绘制一条平滑线,例如绘图的轮廓/天际线?
- python - Django 过滤器:使用分页器在用户和配置文件模型中搜索
- batch-file - 替换多个子目录中的部分文件夹名称
- python - 为 YOLOv3 分割基于图像的数据集