Tencent Cloud SpringBoot Deployment + HTTPS Configuration
springboot can be packaged as jar and war, jar not much to say, a recent project needs to be packaged as war release, roughly speaking it.
Let's start by looking at the general structure of the project.
The first step is to exclude the tomcat plugin that comes with springboot
Then, don't forget to change the default jar to war for the project you want to package
In step 3, since we are using an external tomcat, we need to add the servlet dependency.
In step 4, create a new startup class under the same level package as application.
The final step, then, is to pack.
After the package is successfully packed, visit our domain at
http://imoocdsp.com/imooc-video-mini-api/hello
As shown above, it means that the project has been successfully published
Next, configure https.
First go to buy some free certificates for a year, Tencent Cloud has them, of course, use Ali Cloud or other providers can also be used, apply for a certificate to download successfully and get the following:
Open the tomcat folder at.
And upload the file to tomcat's conf path, as shown here.
Add port 443, which is the port for ssl.
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" keystoreFile="conf/www.domain.com.jks" keystorePass="changeit" clientAuth="false" sslProtocol="TLS" />
It is recommended to put it under port 80, it is important to note that keystorePass is your certificate password, here you need to change it yourself:.
Finally don't forget that port 443 on your cloud server needs to be open at
The final access address can be seen to have been successful and HTTPS access is now available at