Multiple Domains with Public IP
Setting Up Multiple Domains with Public IP
Requirements
- Registered domain names or administrative access to their DNS settings.
- A Tomcat environment with a public IPv4 address.
- One deployable WAR package for each application.
- A unique application context for every domain.
Create the Environment
1Open the platform dashboard
Sign in to your PaaS account and click Create environment or New Environment.
2Select Tomcat and enable Public IPv4
In the topology wizard, choose Tomcat as the application server, enable Public IPv4, define the resource limits, enter an environment name such as multibinding, and create the environment.
After provisioning is complete, the environment appears in the dashboard.
Bind Domains to the Public IP
Expand the Tomcat node details and copy its public IP address. Configure the DNS records for every domain so that they point to this address.
Deploy Applications to Separate Contexts
3Upload the WAR packages
Open Deployment Manager and upload the application WAR files.
4Deploy each application separately
Deploy every package to the same Tomcat environment, but assign a different context to each application, such as firstdomain, seconddomain, and thirddomain.
Configure Multiple Tomcat Hosts
5Open the Tomcat configuration
Click Config for the Tomcat application-server layer.
6Edit server.xml
Open server.xml in the Tomcat server directory and add one <Host> block for each custom domain.
<Host name="firstdomain.com"
appBase="webapps/firstdomain">
<Alias>firstdomain.com</Alias>
<Context path="" docBase="."/>
</Host>
<Host name="seconddomain.com"
appBase="webapps/seconddomain">
<Alias>seconddomain.com</Alias>
<Context path="" docBase="."/>
</Host>
<Host name="thirddomain.com"
appBase="webapps/thirddomain">
<Alias>thirddomain.com</Alias>
<Context path="" docBase="."/>
</Host>
name and Alias
Enter the custom domain name.
appBase
Enter the folder corresponding to the application context under webapps.
server.xml before editing it. Invalid XML can prevent Tomcat from starting.
Restart and Verify
7Save and restart Tomcat
Save the updated server.xml file and restart the Tomcat node.
Open each custom domain in a browser. Every domain should load the application linked to its matching Tomcat context.
Application Redeployment Note
server.xml configuration, temporarily comment out the related <Host> block. After redeployment completes, uncomment the block and restart Tomcat if required.
