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://
http://localhost/test
http://
As Mark B already answered correctly the problem was a misconfiguration in /etc/hosts. The correct configuration is:
/etc/hosts
# /etc/hosts 127.0.0.1 test.localhost