How to configure subdomains for Apache2 on Ubuntu? How to configure subdomains for Apache2 on Ubuntu? apache apache

How to configure subdomains for Apache2 on Ubuntu?


As Mark B already answered correctly the problem was a misconfiguration in /etc/hosts. The correct configuration is:

# /etc/hosts127.0.0.1     test.localhost


The blog post you linked to (from my blog) instructs to set up a new VirtualHost element with an ip of 127.0.0.2 so you can create multiple subdomains easily.

You're setup using 127.0.0.1 will work great for one subdomain, but if you plan on adding more, I'd suggest setting up the new VirtualHost elements as described in the post.


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.