Multiple Domains Tutorial for our Tomcat Web Hosting

javapipe java hosting

This tutorial explains how you can host multiple domains with a private Tomcat web Hosting package at JavaPipe using a pointer or secondary domain.

While both secondary and pointer domains share the main package's tomcat there are differences as listed below.

Secondary domain is separate domain hosted within your existing hosting package. It contains its own email accounts as well as its own hosted folders for placing your webapps.

Pointer domain are domains that mirror your existing domain. They do not come with their own folder structure. However, you can utilize this domain for a different webapp by configuring a host entry for this domain in your server.xml to point at tomcat/webapps/anotherwebapp.

Using Secondary Domains

Secondary domains requires a little configuration on the administration side, so you will need to submit a ticket for each secondary domain that you setup. Please follow steps below.

  1. Create Secondary domain in Siteworx with the domain that is registered by you.
  2. Be sure that the secondary domain is using the same Nameservers as your primary domain.
  3. Submit a ticket via your Clients Area on Javapipe.com with the domain you wish to use as secondary domain so that we can add appropriate configuration for its entry in the httpd.conf
  4. Create new folder called webapps in /home/username/secondarydomainname.com/webapps
  5. Upload your webapp or war file to the new webapps directory.
  6. Add new host entry in your /home/username/primarydomain.com/tomcat/conf/server.xml just before the closing </engine> tag using the template below:
<Host name="{secondarydomain.com}" debug="0"
     appBase="webapps"
       unpackWARs="true" autoDeploy="true">

<alias>{www.secondarydomain.com}</alias>

<Valve className="org.apache.catalina.valves.AccessLogValve"
     directory="/home/{username}/var/{secondarydomain.com}/logs"
       prefix="{secondarydomain.com}_log." suffix=".txt"
         pattern="common" resolveHosts="false"/>

<Context path="/"
     docBase="/home/{username}/{secondarydomain.com}/webapps/{webappname}" 
       crossContext="false" reloadable="true">
</Context>

</host>

Substitute {username},{secondarydomain.com} and {webappname} with your own correct values.

Once done, restart your tomcat. The war will deploy and typing secondarydomain.com in your url will pull up the newly deployed webapp

Limitations of Secondary Domains

Shares your existing tomcat installation. If you shut it down, both sites, primary and secondary domains, go down.

Using Pointer Domains

  1. First thing you need to do is to create a pointer domain in you SiteWorx control panel.
  2. Then you need to add a Host entry in your server.xml (It is a very good idea to back up this server.xml file before editing it.) Be careful not to change any of the port information - doing so could get your site suspended.

Place following code just before the closing </engine> tag

<Host name="{pointerdomain.com}" debug="0"
     appBase="/home/{username}/{primarydomain.com}/tomcat/webapps/{webappname}"
       unpackWARs="true" autoDeploy="true">

<Alias>{www.pointerdomain.com}</Alias>

<Valve className="org.apache.catalina.valves.AccessLogValve"
     directory="/home/{username}/var/{primarydomain.com}/logs" 
       prefix="{pointerdomain.com}_log." suffix=".txt"
         pattern="common" resolveHosts="false"/>

<Context path="/"
     docBase="/home/{username}/{primarydomain.com}/tomcat/webapps/{webappname}"
       crossContext="false" reloadable="true">
</Context>

</Host>

Replace {username}, {domain.com}, {pointerdomain.com} and {webappname} with your own.

Set up the webapp or drop in a new WAR file of the new webappname in your webapps directory.

Restart tomcat.

Limitations for Pointer Domains.

  • There is no seperate email system for pointer domains. This email address is being protected from spambots. You need JavaScript enabled to view it. and This email address is being protected from spambots. You need JavaScript enabled to view it. are the same.