900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > nginx的https配置及nginx端口转发ssl服务端口

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

时间:2019-08-30 17:30:48

相关推荐

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

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。