微信小程序使用网络相关的API有
严格要求 ,只支持域名并且需要Https证书。
服务使用springboot,8082端口。
通过nginx 将 https://law.loadpeople.com 反向代理到
http://law.loadpeople.com:8082,并增加SSL证书。
#http重写到https
server {
listen 80;
server_name law.loadpeople.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
#SSL
server {
listen 443;
server_name localhost;
ssl on;
root html;
index index.html index.htm;
ssl_certificate
cert/214897222470878.pem;
ssl_certificate_key
cert/214897222470878.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;
ssl_prefer_server_ciphers on;
location / {
#反向代理
proxy_pass http://127.0.0.1:8082;
root
html;
index
index.html index.htm;
}
#文件服务器
location /files/ {
root /home/law/upload/;
autoindex
on;
}
}