I have been struggling with this for a day and more now. As i am new to server setup stuff. Been following many tutorial and docs on net regarding the same, many hit and run, But got no luck.
Here is what i did till now.
- I got my vps running and it has Apache running at port 80. 
- I installed Tomcat 7.0.55 at port 8080 and it is up and running. 
Now we have to route traffic from Apache to Tomcat
modifying the 000-default.conf of apache to look like this.
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> <VirtualHost *:*> ProxyPreserveHost On # Servers to proxy the connection, or; # List of application servers: # Usage: # ProxyPass / http://[IP Addr.]:[port]/ # ProxyPassReverse / http://[IP Addr.]:[port]/ # Example: ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ ServerName localhost </VirtualHost> This successfully redirected my each request to tomcat.
- Now running my registered domain name in browser. www.mytestdomain.com. i am landing on the default tomcat page. and writing the server ip in browser address bar is also landing me to the same tomcat page.
5 Now i need www.mytestdomain.com to point to my app deployed in tomcat at $CATALINA_HOME/webapps/www.mytestdomain.com
6 And other test.mytestdomain.com to point to my app deployed in tomcat at $CATALINA_HOME/webapps/test.mytestdomain.com
7 And xx.xx.xx.xx my ip to land at default tomcat page only.
That what i want to achieve and not able to do that.
8 Now following
http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html
I updated my $CATALINA_HOME/conf/server.xml to have one more host. After updating my server.xml file look
 <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> <Host name="www.mytestdomain.com" appBase="webapps-new" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="www.mytestdomain.com_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> - I created new appBase directory mkdir $CATALINA_HOME/webapps-new 
- Within $CATALINA_HOME/webapps-new folder i created symlink for my webapp. ln -s ../webapp/www.mytestdomain.com ROOT 
- cd $CATALINA_HOME/webapps-new/ROOT/WEB_INF/ 
- Created context.xml in META-INF file with content as below. 
- Restarted Apache and Restarted Tomcat - [ok] 
- Results. --> www.mytestdomain.com in browser is hitting my tomcat webapp properly. 
- But test.mytestdomain.com and xx.xx.xx.xx my ip in browser is also hitting my same webapp as for www.mytestdomain.com . They should have gone to the default host. 
I had tried many other tricks but not luck.
Any help would be appreciated. This is very much possible that i know.
Thanks
