简体   繁体   中英

deploy different spring boot wars on external tomcat with same port

how do I deploy different spring boot wars on tomcat container I have 3 wars with name

myapp1.war

myapp2.war

myapp3.war

I have added these wars into tomcat webapps folder and did some changes in server.xml under <Host? tag.

<Context path="/apipath" docBase="myapp1" reloadable="true"></Context>

I can access the application on http://localhost:9080/apipath/mymethoduriapp1 Now if I put another Context path in same host tag for other war like

<Context path="/apipath" docBase="myapp2" reloadable="true"></Context>

server unable to start now.

is there any way that we can have multiple context path so I can access all application on same port. example.

http://localhost:9080/apipath/mymethoduriapp1

http://localhost:9080/apipath/mymethoduriapp2

http://localhost:9080/apipath/mymethoduriapp3

Thanks in advance for help

No you can't have multiple apps listening on the same port. How would the kernel know which application to send the packages to? What you can do that run a http server such nginx or apache which gonna listen on 9090 and each app in a different port and then proxy the requests based on the URL to the desired app.

nginx is probably the most popular and easier to setup , Below shows the basic configuration for this case

Nginx Reverse Proxy. Multiple Applications on One Domain

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