Nginx 负载均衡--(4)配置HTTPS 与 HTTP 同时存在
来源:互联网 发布:刘耀林 知乎 编辑:程序博客网 时间:2024/06/03 20:09
使用ssl模块配置同时支持http和https并存
这里省略了如何配置证书,所以权当大家都有已经生成好的证书。
给nginx配置SSL证书之后,https可以正常访问,http访问显示400错误,nginx的配置如下:server { listen 80; listen 443; server_name spring.com; root /var/www/html; ssl on; ssl_certificate /usr/local/nginx/server.crt; ssl_certificate_key /usr/local/nginx/server.key; }
http访问的时候,报错如下:
400 Bad RequestThe plain HTTP requset was sent to HTTPS port. Sorry for the inconvenience.Please report this message and include the following information to us.Thank you very much!
说是http的请求被发送到https的端口上去了,所以才会出现这样的问题。
server { listen 80; listen 443 ssl; server_name spring.com; root /var/www/html; ssl_certificate /usr/local/nginx/server.crt; ssl_certificate_key /usr/local/nginx/server.key; }
把ssl on;这行去掉,ssl写在443端口后面。这样http和https的链接都可以用,完美解决。
阅读全文
0 0
- Nginx 负载均衡--(4)配置HTTPS 与 HTTP 同时存在
- 配置nginx实现负载均衡和HTTPS
- 配置NGINX同时运行 https 和 http
- 【Nginx】Http负载均衡与反向代理
- nginx http和https 多域名负载均衡
- Nginx Http负载均衡
- Nginx负载均衡--(3)Nginx负载均衡配置
- nginx支持负载均衡及https安装配置
- Nginx负载均衡与集群配置
- nginx代理与负载均衡配置
- nginx负载均衡介绍与配置
- Nginx安装与负载均衡配置
- nginx 负载均衡配置
- nginx配置负载均衡
- nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- 企业有安全产品,为什么还要做安全服务?
- 沃通CA应邀出席中国区块链峰会,当选联盟副理事长单位
- Vuforia SDK---- Vuforia AR开发对焦
- nginx 安装
- 装饰模式
- Nginx 负载均衡--(4)配置HTTPS 与 HTTP 同时存在
- 删除7天前的文件
- cpu架构(3)——risc和cisc的区别
- 常见JAVA面试问题
- spring @scheduled 定时任务详解
- [deeplearning-008] convertional neural networks卷积神经网络
- SpringMVC教程 入门案例 常见问题
- MySQL SQL_MODE详解
- mui初级入门教程(七)— 基于native.js的文件系统管理功能实现