nginx 将http的请求转发为https

使用 nginx 实现  原 http的请求 转发为 https 的请求

我使用的版本为  nginx-1.22.1

修改 nginx.conf

复制代码
server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            #root   html;
            #3index  index.html index.htm;
            proxy_pass https://bjszf.zchyit.com.cn:9000;
        }
复制代码

 其中

 listen 80;   被监听的端口,也可以改为其他端口
 server_name localhost;       原请求的地址

 proxy_pass https://bjaaf.bbhyit.com.cn:9000;   要转发的目标地址

测试方法

 原理就是将  http://localhost:80 的请求 转发至  https://bjaaf.bbhyit.com.cn:9000  地址上

 

posted @   海乐学习  阅读(1587)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2022-03-21 java Maven 多模块编程时当换个目录就会发生找不到jar的问题
点击右上角即可分享
微信分享提示