Super User is a question and answer site for computer enthusiasts and power users. 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

How can I set up multiple apache local web sites on Ubuntu?

I added the following to httpd.conf:

<VirtualHost *:80>
DocumentRoot "/wwwroot/htdocs/firstsite/"

Now I try to go to but browser says he can't find server.

Though, firstsite folder is created in htdocs, and it contains index.html (that is intended to show up in browser)

wwwroot is directory where apache is installed

share|improve this question
Your browser needs to know an IP address, so add the dummy to your /etc/hosts file, like I wrote. – Arjan Feb 25 '10 at 11:28
Can't this be done without editing hosts file? – Emenims Feb 25 '10 at 11:41
That would require a DNS server. Or registering a true domain, and mapping your server to your public IP address. (But even then some home routers require you to use the hosts file, for otherwise the browser cannot connect to that public IP address from within your own network.) – Arjan Feb 25 '10 at 12:02
@Arjan is right, if you want to resolve to localhost you need hosts or DNS. if you run DD-WRT/OpenWRT on your home router you may be able to tweak it to add your own DNS settings there; hosts is easier tho. – quack quixote Feb 25 '10 at 12:35

Your browser needs to know an IP address, while the server then needs more details as for which site to serve. So, to host multiple sites on localhost you cannot serve all of them at http://localhost or Instead:

share|improve this answer

you can use rapache to have a GUI to setup your domains instead of editing the config by hand.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.