Spring Boot和Apache2在同一服务器和端口上

时间:2018-09-15 16:27:58

标签: apache spring-boot server

我正在寻找在同一端口和服务器上启用Apache2和spring boot应用程序的解决方案。启动应用程序已打开 通过内部的tomcat服务器。 Apache(wordpress)应该在端口443或80上运行,并且主URL应该是:https://domian.dd/blog。其余的URL应该由Spring Boot处理。

第一个问题是我无法在同一端口上打开两个应用程序。 第二个问题是Spring Boot可以将端口80转发到443。

谢谢。

1 个答案:

答案 0 :(得分:0)

您不能在同一台计算机上的同一端口上运行两个应用程序,但是可以通过以下方式实现所需的功能。

  1. 使用https://localhost:8443/myapp

  2. 这样的路径运行spring boot应用程序
  3. 运行apache并安装ssl

  4. 在ssl.conf中进行以下设置,将您的应用流量转发到Spring Boot应用

    SSLProxyEngine on
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off
    ProxyRequests Off
    ProxyPass /myapp https://localhost:8443/myapp
    ProxyPassReverse /myapp https://localhost:8443/myapp
    
  5. 如果/var/www/html是根文件夹,则将博客站点放置在apache根文件夹/博客下,那么博客将位于/var/www/html/blog

相关问题