Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

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/

share|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
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.