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

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
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:

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

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.