今天在配置nginx的https支持,把phpmyadmin放在一个子目录下,即https://ip/phpmyadmin,登录出现The plain HTTP request was sent to HTTPS port错误,现给出解决方法:
1.在location ~ \.php$区域添加fastcgi_param HTTPS on;如以下代码:
- location ~ \.php$ {
- fastcgi_index index.php;
- include /etc/nginx/fastcgi_params;
- fastcgi_param HTTPS on;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_pass 127.0.0.1:9000;
- }
2.在http区域添加
- map $scheme $fastcgi_https {
- default off;
- https on;
- }
如例子:
- http
- {
- map $scheme $fastcgi_https {
- default off;
- https on;
- }
-
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- .........
- }
之后重载nginx即生效.