I use Ubuntu 10.10 on my laptop.

I added the following to /etc/apache2/httpd.conf

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/square/public"
ServerName square.localhost
</VirtualHost>

And restarted the apache.

I go to http://square.localhost/ and it gives an error telling server not found.

Could anyone tell me how to define virtual host settings on Ubuntu please?

Thanks in advance.

link|improve this question

55% accept rate
Did you set up square.localhost to have a DNS or hosts file entry so that it resolves to the IP address of your lap-top ? – Iain Dec 28 '10 at 10:18
feedback

1 Answer

up vote 1 down vote accepted

You should not modify the httpd.conf file, but add a new conf file inside /etc/apache2/sites-available/

This tutorials should clarify you how it works:

http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2

http://brucewampler.wordpress.com/2009/02/28/adding-virtual-hosts-to-ubuntu-apache/

link|improve this answer
I tried both, but it does not work. – shin Dec 28 '10 at 12:01
It worked with the second link. thanks. – shin Dec 28 '10 at 12:44
feedback

Your Answer

 
or
required, but never shown

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