I am looking for the best method to host multiple websites developed using Spring Boot.
I have a public IP and it points to EC2 machine.
Already I am running one web application on it, developed using Spring Boot.
Now, I am looking for a way to create my second Spring Boot application(running on a different port).
My configuration should result like this(Single public IP),
www.app1.com(x.x.x.x) => Spring Boot App1
www.app2.com(x.x.x.x) => Spring Boot App2
I found many articles on internet dealing with conf/server.xml file, http://tomcat.apache.org/tomcat-7.0-doc/config/host.html
Can someone help me to achieve the same
To use name-based virtual hosting, you must designate the IP address (and possibly port) on the server that will be accepting requests for the hosts. This is configured using the NameVirtualHost directive.
With this configuration, the application is ready to deploy to any external application server. Once this is done, you can package your Spring Boot application as a war and deploy it to the JBoss server. To do that, you need to run mvn clean package , which will generate the war file.
SpringApplication#run bootstraps a spring application as a stand-alone application from the main method. It creates an appropriate ApplicationContext instance and load beans. It also runs embedded Tomcat server in Spring web application.
The best way is probably to use a reverse proxy front end. E.g. install nginx on your EC2 box, or (probably better if you are serious about it) use an ELB, and Route 53 to register your DNS record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With