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?
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" resourceName="UserDatabase"/> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" deployIgnore=".svn"> </Host> <Host name="22.214.171.124" appBase="extraserver"/> </Engine>
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
extraserver as appropriate.
then you would be able to deploy your apps using autodeploy, but to the alternative webapps appsBase.