背景
🚀 背景:使用 Nginx 1.24.0 代理前端及后端应用,假设称之为 A 系统。A 系统最初使用的是 http 协议,后来改成了 https 协议。
Nginx 配置 https 访问【图文教程】:Nginx 配置 https 访问
😭 问题:修改为 https 协议后,发现一些问题。即依赖 A 的系统没有改成 https,导致报错。
👉 需求:
- 一个端口既支持 http 协议,也支持 https 协议
- 待依赖 A 的系统修改为 https 协议后,再将 http 协议下线
👉 具体案例
- 当前 nginx 访问地址:http://172.24.3.241:8888
- 需要 http 和 https 同时支持,即如下两种方式都可访问
- http://172.24.3.241:8888
- https://172.24.3.241:8888
解决
以下示例,是在基于 yum 安装 nginx 的基础上来做的。