微信小程序-nginx-https 代理后端服务

微信小程序 nginx https 反向代理后端服务

作者: 张首富
时间: 2020-12-17

nginx 配置如下

server {
        listen       443 ssl;
        server_name  test.zhangshoufu.com;
        #ssl on;
        ssl_certificate   /etc/nginx/cert/4595406__guiji.ai.pem;
        ssl_certificate_key  /etc/nginx/cert/4595406__guiji.ai.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        
        location / {
		add_header Access-Control-Allow-Origin *;
                proxy_next_upstream http_502 http_504 error timeout invalid_header;
                proxy_redirect off;
  		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  		proxy_set_header X-Real-IP $remote_addr;
  		proxy_set_header Referer 'no-referrer-when-downgrade';
  		proxy_pass  http://10.1.1.124:19033;	#替换成自己后端服务
        }
}
posted @ 2020-12-17 16:26  张首富  阅读(1237)  评论(0编辑  收藏  举报