I adopted these instructions to configure subdomains for apache. I'm able to access the subdomain using http://localhost/test though I am unable to can get on via http://test.localhost. How do i realize the later?

# /etc/apache2/sites-available/test.localhost
<VirtualHost *:80>

    # Server name
    ServerName test.localhost

    # Document root
    DocumentRoot /var/www/test/

    # Custom log file locations
    ErrorLog  /var/www/test/logs/error.log
    CustomLog /var/www/test/logs/access.log combined


Make it forward yourself. this is the way used to do it online at the office to toward a photography enthusiasts bio... i put this towards the top of my index.php:

    $subD = explode('.', $_SERVER['HTTP_HOST']);
        if ($subD[2] && $subD[0]!='www'){
        header('Location: http://www.yourdomain.com/'.$subD[0]);

As Mark B already clarified properly the issue would be a misconfiguration in /etc/hosts. The right configuration is:

# /etc/hosts     test.localhost

Your blog publish you associated with (from the blog) instructs to setup a brand new VirtualHost element by having an ip of 127...2 so that you can create multiple subdomains easily.

You are setup using 127...1 works ideal for one subdomain, but when you intend on adding more, I'd suggest establishing the brand new VirtualHost elements as referred to within the publish.