×××小程序接口实现 https 并通过域名进行访问
关于tomcat接口调试的问题 :要实现通过这个接口https:/域名/具体路径,访问后端tomcat
重点:因为我们公司是阿里的云服务器,所以需要现在阿里上生成证书,并绑定域名,然后在反向代理服务器的nginx配置文件里面 https下面 添加信息,实现通过域名跳转至后端tomcat指定端口。
vim /etc/nginx/nginx.conf
vim /etc/nginx/nginx.conf
....
....
....
server {
# ssl_session_cache shared:SSL:1m;
listen 443;
server_name 域名;
ssl on;
ssl_certificate cert/证书.pem;
ssl_certificate_key cert/证书.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;
index main.html;
root /opt/app/client/www;
access_log /opt/log/nginx/m.access.log main;
include /etc/nginx/default.d/*.conf;
location /recomm/api {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://后端服务器IP:port端口;
}
}
原文地址:http://blog.51cto.com/13922718/2171061
时间: 2024-10-06 04:28:24