Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to configure tomcat to have 2 virtual hosts one is configured with an alias that matches a domain name that is configured in my dns. The other virtual host needs to respond to requests sent directly to the ip address of the server. Is this possible? How do I configure the second virtual host?

share|improve this question

The documentation on using tomcat for virtual hosting suggests you would want to modify your server.xml to include an additional Host element like so;

<Engine name="Catalina" defaultHost="localhost">
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false"

<Host name="" appBase="extraserver"/>


and then make the required parallel directories using the following steps;

mkdir $CATALINA_HOME/extraserver
mkdir $CATALINA_HOME/conf/Catalina/extraserver

(where you would have to set you $CATALINA_HOME and extraserver as appropriate.

then you would be able to deploy your apps using autodeploy, but to the alternative webapps appsBase.

share|improve this answer
Change your second <Host>'s name to the IP address instead of "" and you'll get my upvote. – Christopher Schultz May 24 '12 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.