正所谓前人栽树,后人乘凉。
感谢Huxpro提供的博客模板
产生csr文件
keytool -genkey -alias tomcat -keyalg RSA -keysize 2048 -keystore xxx.xx.x.jks
keytool -certreq -alias tomcat -file csr.txt -keystore xxx.xx.x.jks
其中xxx.xx.x为文件名,一般是域名xxx.xx.x
生成证书
登录网址https://freessl.org 根据csr文件生成证书.验证方式选择文件校验
证书校验
把下载的校验文件放到服务器上,手动验证文件访问是否正常
http://xxx.xx.x/.well-known/pki-validation/fileauth.txt 点击界面校验,校验通过后提供可以下载的证书文件chain.zip
tomcat配置证书
编辑server.xml
<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="/home/web/ssl/xxx.xx.x.jks" keystorePass="password"
clientAuth="false" sslProtocol="TLS" />
springboot配置证书
server:
port: 443
ssl:
key-store: classpath:ssl/xxx.xx.x.jks
key-store-password: *********
key-store-type: JKS
key-alias: xxx.xx.x
enabled: true