Reputation: 53
I have a Java web app running on Tomcat behind Apache. I want to launch a new Tomcat container for each new customer, but all of them behind the same Apache. Each client has its own subdomain, and Apache proxies them to the right Tomcat instance. Here is an example of my Apache configuration for one customer:
sites-enabled/app1.conf:
<VirtualHost *:80>
ServerName app1.domain.com
ProxyPass / ajp://tomcat1:8009/
ProxyPassReverse / ajp://tomcat1:8009/
</VirtualHost>
Then I start the Apache container with --link tomcat1
and everything works just fine.
What I'm trying to figure out how to do is to add new Tomcat containers dynamically after the Apache container is already running and have Apache to reference them correctly.
The issue is that even adding sites-enabled/app2.conf
to the Apache container dynamically, it doesn't work because when the Apache container didn't have a --link tomcat2
when it was launched, hence it doesn't know how to reach the new Tomcat container.
Do you guys have any ideas of how I can get this to work other than stopping the Apache container and relaunching it with the --link tomcat2
argument?
Upvotes: 2
Views: 1509
Reputation: 1652
Links are considered legacy and have been replaced with networks. Join apache and all tomcat containers into the same bridge network
to achieve direct connectivity between them, then you can create and remove tomcat containers at will.
Upvotes: 1