nginx的https配置及nginx端口转发ssl服务端口

25 篇文章 3 订阅
6 篇文章 0 订阅

server在http配置内容如下:

   server {
	listen    443 ssl; #监听端口,Nginx1.5后推荐使用
        server_name  www.test.top; #请求域名 
        ssl_certificate    cert/test.top_bundle.pem;  #crt证书路径,存放位置Nginx的conf/l文件夹下,可以使用绝对路径
        ssl_certificate_key cert/test.top.key; #crt证书key路径
        ssl_session_timeout 5m; #会话超时时间
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;  #加密算法
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #表示使用的TLS协议的类型。
        ssl_prefer_server_ciphers on;
     
     # 拦截api请求 
	location /api/ {
                proxy_pass  http://localhost:7788/api/; #服务访问地址,内网转发时需要填写内网地址

        }
        
   # 拦截所有请求
	location / {
            root   html; #站点目录
            index  index.html index.htm;
        }

微信小程序正式发布版本的时候,需待用https的get接口:
1.调试可用http://test.top:7788/api/。不需要ngnix转发,直接调用http端口。
2.正式版本改为:https://test.top/api/
反向代理的方式,即不改变原本的server配置。直接通过反向代理将test.top/api/重定向到http://test.top:7788/api/
跳转流程:api请求–>80–>443 -->7788

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值