Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 been trying to set an Apache name based Virtual host(http://test.local) to the directory /var/www/test, but it keps on pointing to the default /var/www directory.

My test.local configuration file looks like this- My hosts file looks like this- And the ports.conf file looks like this-

As per suggestion form IRC chat I disabled the default Virtualhost, then something wierd happened. Now http://test.local, loads contents of /var/www. But http://localhost shows the contents inside /var/www/test.

I'm using likewise-ope to connect to windows domian based network, it has created an entry in hosts file(the first line, also included is the next two lines))- asset11 localhost artis.local test.local

How can I make http://test.local to point to /var/www/test correctly

share|improve this question
up vote 2 down vote accepted

Your local.test file you put on pastebin looks good, just uncomment the directory part.

The <Directory ...> - by the way - must point to the same path as the DocumentRoot (/var/www/test/ in your case).

Then you need to activate that file through sudo a2ensite test.local and reload your apache with sudo /etc/init.d/apache2 reload.

share|improve this answer
Thanks for the answer, But as far as I know <Directory /> directives are not absolutely necessary, but can be used where we need some directory specific directives. – saji89 Feb 3 '12 at 10:32
I counsel always to use the directory directives, because it happened too often to me that a .htaccess didn't worked. Of course it is not absolutely necessary. – Marc-André Appel Feb 3 '12 at 10:34

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.