简体   繁体   中英

Spring Boot and Apache2 on the same server and port

I am looking for solution to enable Apache2 and spring boot application on the same port and server. Boot Application is turn on through the internal tomcat server. Apache ( wordpress) should work on port 443 or 80 and main url should be: https://domian.dd/blog . Rest of urls should be processed by Spring Boot.

First problem is that I cannot open two application on the same port. Second problem is that Spring Boot has configutaion to forwarding port 80 to 443.

Thanks.

You can not run two application on same port on same machine but you can achieve what you are looking for by following way.

  1. Run your spring boot application with path like https://localhost:8443/myapp

  2. Run apache and installed ssl

  3. Make below settings in ssl.conf to forward your my app traffic to spring boot app

     SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off SSLProxyCheckPeerExpire off ProxyRequests Off ProxyPass /myapp https://localhost:8443/myapp ProxyPassReverse /myapp https://localhost:8443/myapp 
  4. Put your blog site under apache root folder/blog if /var/www/html is root folder then blog would be under /var/www/html/blog

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM