Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently configured Virtual Host in my Ubuntu 11.10. But whatever site i type, it always redirects to the localhost page.

This is my "our-test-site" file:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/zftut/public
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory /var/www/zftut/public/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

and this is my, "etc/hosts" file:   localhost   our-test-site.local   zftut.local   System.B    System

Now when I try to go for "zftut.local", it redirects me to localhost page, showing me this:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

What am I doing wrong? I refered "this" tutorial for setting up virtual host.

share|improve this question
What URL do you get redirected to? What does the access and (debug-enabled) error logs say? – womble Apr 7 '12 at 7:00
up vote 1 down vote accepted

You did not show us your complete apache configuration. I think you still have the default VH definition.

You need to add the ServerName line:

ServerName www.zftut.local
ServerAlias zftut.local *.domain.tld

The ServerAlias is optional and helps you get to the correct VH for several names. In this example, all DNS names that ends with zftut.local. Of course, you need to setup proper DNS records (or line in hosts file) for each name you want to use.

share|improve this answer
Thank you, i had to add the servername and the server alias.. It worked. – Salman Apr 7 '12 at 7:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.