Pages

2022年6月14日星期二

HTTPS for Java Spring Boot

Using Lets Encrypt is not suitable for spring boot I think, because its certbot doing verification with static content, while you serving single jar file in your system (no /static folder). You should modify some project structure, and it sucks

Instead, you should go to ZeroSSL, choose verification via CNAME record instead of HTTP upload

Got your certificate!




After getting certificate, you should install it
in case you have Tomcat server, your Spring boot code will have server.xml
But mine is not, maybe because it is standalone jar file

so to install the cert, follow this guide:
https://medium.com/@marianfurdui/generate-a-java-keystore-from-lets-encrypt-for-java-web-spring-or-spring-boot-applications-bf07408158ef

from that guidance, you will get file ending in .p12

after which, you should set it up on your application.properties like so


souce: http://www.heydari.be/2016/05/14/Spring-Boot-Application-Secured-by-Lets-Encrypt-Certificate.html
dont forget to match your server.ssl.keyAlias with the -name you created previously (maybe its root or keybin or tomcat)



That was I long journey. I started at 05.30 and finish at 09.00. About 3,5 hours to get my instance up and run with HTTPS

没有评论:

发表评论