Setting Up Multiple Domains with Public IP
The Benefits of Having Multiple Domains
Here are two key benefits of using multiple domain names on your application:
- Usability: Multiple domain names provide multiple points of entry, which is useful for directing users to different themed sites based on marketing campaigns or user experiences. Because of its flexibility, you can customize the user’s needs according to various situations.
- Cost Saving: Hosting multiple domains in a single environment can save costs. For instance, you can run two different applications with distinct domains on a single Tomcat instance, optimizing resource utilization and reducing infrastructure expenses.
Setting Up Multiple Domains for Your Application
To use a domain name for your application, follow these steps:
Step 1. Log in to your PaaS (Platform as a Service) account.
Step 2. Once you’re on the platform dashboard, locate and click the “Create Environment” button:
Discover how to create and manage the environment with AccuWeb.Cloud
Step 3. In the Environment Topology dialog, select your desired application server (e.g., Tomcat), enable Public IPv4 for your server, and enter a name for your environment (e.g., binding).
Your environment with Tomcat will be successfully created within a minute.
Step 4. Associate your domain names with Tomcat’s Public IP address, which you can locate in the server’s drop-down list. The specific process for binding domains depends on the hosting company where you purchased the domains.
Step 5. Upload your WAR file(s) to the Deployment Manager and deploy them to different contexts as needed.
Step 6. Click on the “Config” button for Tomcat.
Step 7. Navigate to the server.xml file located in the Tomcat server directory at the following path.
Within this file, configure the hosting of multiple domains by adding <Host> tags for each domain you want to host.
For example:
<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>
Step 8. Save the changes and restart Tomcat.
Step 9. Check the results. Your application(s) will be available through the specified domain names.
After redeployment, remember to uncomment the <Host> block to ensure proper functionality.










