通过jdk工具生成keystore(jks)文件
1.设置自签口令
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
2.转换为p12
输入新密钥库口令(至少6位)
源秘钥库口令若未设置为空,直接回车
输入自签口令(至少6位)
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12
3.使用openssl命令导出.crt
openssl pkcs12 -in keystore.p12 -nokeys -out my_key_store.crt
4.使用openssl命令导出.key
openssl pkcs12 -in keystore.p12 -nocerts -nodes -out my_store.key
这里只是针对jar部署方式配置https访问
后端配置
1、修改application-prod.yml文件
server:
ssl:
key-store: keystore.jks
key-store-password: password
keyStoreType: JKS
前端配置
1、需改index.html文件
window._CONFIG[‘domianURL’] = ‘https://xxx.xxx.cn:3001/jeecg-boot’;
2、修改vue.config.js文件
target: ‘https://xxx.xxx.cn:3001’
修改ngin