SpringBoot http升为https(自签SSL证书,局域网内使用)http重定向https
-
首先要生成证书,到服务器jdk的bin文件夹下执行命令行:keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keyword.p12 -validity 3650 ,输入密码,剩下的可以不输,直接全部回车,执行完之后会在当前文件夹内生成一个keyword.p12的文件。
-
将keyword.p12拷贝至resources目录下,然后在pom.xml中添加:
<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>**/*.p12</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes>