I followed these instructions to configure subdomains for apache. I can access the subdomain using http://localhost/test though I cannot access it via http://
Configuring subdomain is very easy when working with apache tomcat 7 and ubuntu server.
http://javatute.com/javatute/faces/post/tomcat/2014/configuring-subdomain-in-server.xml.xhtml
Actually subdomain takes time to configure as we add it using cPanel at least 2-3 days and then configuring server.xml and restarting tomcat we can run it as expected.