想要给两个小程序接口或者网页都开启https访问,配置ssl。
nginx配置如下:
server {
#监听443端口
listen 443 ssl;
listen [::]:443 ssl;
#你的域名
server_name abc.com;
#ssl证书的pem文件路径
ssl_certificate "pem文件";
#ssl证书的key文件路径
ssl_certificate_key "key文件";
location / {
proxy_pass http://127.0.0.1:8081/;
}
location /demon1/ {
proxy_pass http://127.0.0.1:8081/;
}
location /demon1/ {
proxy_pass http://127.0.0.1:8082/;
}
}
最后,查看是否成功,在nginx里的cmd里打 nginx - t 查看是否成功,如果成功则:
开通https之后:https://abc.com/demon1/index.html