目錄: 最近開(kāi)發(fā)小程序,小程序開(kāi)發(fā)使用的所有接口都必須是https的
開(kāi)始配置HTTPS 配置完之后,點(diǎn)擊后邊下載, <Connector port='443' protocol='HTTP/1.1'
maxThreads='150' SSLEnabled='true' scheme='https' secure='true'
clientAuth='false' sslProtocol='TLS' keystoreFile='cert/21506440638****.pfx' keystorePass='2150644063******'
>
將端口8443更改為443 在tomcat的web.xml的標(biāo)簽后增加以下代碼
然后重啟tomcat服務(wù)器 二、下邊進(jìn)行配置nginx的https server{
listen 443 ssl; #監(jiān)聽(tīng)443端口
server_name online2.XXXX.cn;#域名
index index.html index.htm; #訪問(wèn)首頁(yè)地址
root D:\wx_address_tomcat\webapps\spring_70_s4s2h5_03;
ssl_certificate 'D:/nginx2/nginx-1.15.1/cert/1648469_online2.XXXX.cn.pem';
ssl_certificate_key 'D:/nginx2/nginx-1.15.1/cert/1648469_online2.XXXX.cn.key';#對(duì)應(yīng)的證書key文件路徑
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
proxy_pass http://localhost:8020; #對(duì)應(yīng)監(jiān)聽(tīng)的接口,轉(zhuǎn)發(fā)的地址
}
}
server{
listen 443 ssl; #監(jiān)聽(tīng)443端口
server_name online2.DDDD.cn;#域名
index index.html index.htm; #訪問(wèn)首頁(yè)地址
root D:\wx_address_tomcat\webapps\spring_70_s4s2h5_03;
ssl_certificate 'D:/nginx2/nginx-1.15.1/cert/1648469_online2.DDDD.cn.pem';
ssl_certificate_key 'D:/nginx2/nginx-1.15.1/cert/1648469_online2.DDDD.cn.key';#對(duì)應(yīng)的證書key文件路徑
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
proxy_pass http://localhost:8888; #對(duì)應(yīng)監(jiān)聽(tīng)的接口,轉(zhuǎn)發(fā)的地址
}
location /resources/ {
**alias D:/apache-tomcat-7.0.59_64/XXXX/ROOT/resources/;#重命名到nginx目錄下,直接由nginx提供,不經(jīng)過(guò)tomcat,所以你們要拷貝或者直接剪切靜態(tài)資源到這邊**
expires 1d; #文件緩存時(shí)間1天,前端會(huì)收到這個(gè)
}
}
|
|