Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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- http://paste.ubuntu.com/827328/ My hosts file looks like this- http://paste.ubuntu.com/827338/ And the ports.conf file looks like this- http://paste.ubuntu.com/827332/

As per suggestion form IRC chat I disabled the default Virtualhost, then something wierd happened. Now http://test.local, http://127.0.0.1 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))-

127.0.0.1 asset11.domain.com asset11 localhost
127.0.0.1 artis.local
127.0.0.1 test.local

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

share|improve this question
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.