SpringBoot 项目和Tomcat 都安装SSL证书造成的443端口占用问题

  • 我的 centos 服务器上运行了个 SpringBoot 项目安装了 ssl 证书
  • 同时这个服务器上还运行了个 tomcat 下面有好几个项目,现在想给 Tomcat 也装SSL
  • 这样会造成443端口占用么?要如何解决?
阅读 6.1k
3 个回答

建议前端nginx装ssl证书,分别代理到后端的各个应用,应用可以监听不同的端口,走http协议。如果你嫌这样麻烦,可以一个443, 一个换成8443(或随便什么其他端口)。

修改了 SpringBoot 项目的SSL默认端口号443为7443,上线测试访问不通,这表示要使用ssl证书,端口号就不能换?
图片描述

建议使用nginx 进行反向代理 多少个都不会冲突

springboot 不需要配置ssl 也不需要充http 强制调到https 交给nginx 来办就好


#强制跳转https 
server {
        listen       80;
        server_name  xxx1.com;
        location / {
            rewrite ^/(.*)$ https://xxx1.com/$1 permanent;
          }
}
#nginx 反向代理springboot 1
server {  
        listen 443 ssl http2;  
        server_name  xxx1.com;
        location / {
        proxy_pass 'http://localhost:8000';
        }

     }
#nginx 反向代理springboot 2
     server {
        listen 443 ssl http2;  
        server_name  xxx2.com;
        location / {
        proxy_pass 'http://localhost:8001';
        }

     }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题