I have two spring boot web applications. I want those applications to be deployed on same port with different endpoints, like
- Application 1 – xx.xx.xx.xx:80/app1
- Application 2 – xx.xx.xx.xx:80/app2
I am trying to deploy these applications using docker in AWS EC2. Please let me know how to do this.
Thank you!
When I tried to deploy two applications on same port, it failed.
2
Answers
You can’t have two apps on a single machine listening on the same port. Can you put both endpoints in the same application?
Having two apps running on the same port on a single machine is impossible. However, you can run applications on each port and combine them using Nginx.
Example:
Application A (/app1) is running on 8080
Application B (/app2) is running on 8081
And the below Nginx Config might cover your case, I guess.