今天接到要求,将项目头部的http,换成https。
我按照网上的方法试了起来,在添加了fpx文件,修改了yml和启动类后。
运行起来,还是没有成功,如图
2021-05-26 16:30:21.522 INFO 14388 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8182 (http) 8181 (http) with context path ''
两个端口都是http,这是为什么呢。我开始检查yml文件和启动类,突然,我看到了下面的这一段
#SSL配置 ssl: key-store: classpath:1111111_xxxxxx.com.pfx #你的ssl证书名称 key-store-password: xxxxxx #你的ssl证书密码 key-store-type: PKCS12 enabled: true server: port: 8182
好家伙,我直接好家伙,原来是我把ssl:配置写到server:的上面去了,进行修改
server: port: 8182 #SSL配置 ssl: key-store: classpath:1111111_xxxxxx.com.pfx #你的ssl证书名称 key-store-password: xxxxxx #你的ssl证书密码 key-store-type: PKCS12 enabled: true