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

Ok, so my set up is as follows:

  • I own a domain, let's call it
  • I have an amazon AWS account with one micro-instance (free tier).
  • and both point to a static IP set up for my instance.
  • Instance is Amazon Linux with apache2 web server. Doc root is the default: /var/www/html
  • I have also set up that points to as a frame URL (This is what needs changing!).

What I want is to have two doc roots (if that's possible), one for my main forward facing site (, let's say I keep it as it is in /var/www/html. But then I need another one for playing around and building apps etc. I would like to serve them up from /var/www/apps and I would point to that from

The reason for this is that I need to be able to have versioning control over the web apps I build, I would keep a separate tree for each one within /var/www/apps. At the moment my apps are served up from /var/www/html/apps so they are under the version control of my main site in html; not ideal.

Ok, I think I've got over as much as I need, hopefully it is understood what I would like achieved. So is this all possible? I can set up multiple static IPs with AWS so maybe each of them can resolve to different doc roots? I'm just getting into the infrastructure side of things so don't know too much about it all, bear with me!

share|improve this question
It tickles me to see this question. This is how hosting multiple websites on a single server was originally done, until the Host: header was added to HTTP, allowing many sites on one IP. – James O'Gorman Dec 30 '11 at 18:40
@JamesO'Gorman Haha, oh it's that obvious I'm a newbie is it! Oh well everybody's got to learn sometime ;) – igneosaur Dec 30 '11 at 20:51
up vote 6 down vote accepted


See the Apache Documentation, and specifically the Virtual Host examples, one of which is partially reproduced below (vhosts distinguished by IP address).

# First Virtual Host (e.g. your main website)    
DocumentRoot /www/example1

# Second Virtual Host (e.g. your apps)
DocumentRoot /www/example2
share|improve this answer
NameVirtualHosts will be better, because they can run on the same ip address. – becomingwisest Dec 30 '11 at 18:39
@ChristopherEvans NameVirtualHosts are another possibility, but they are not a universal solution (particularly if you need SSL support in older browsers) -- The choice is really up to igneosaur though, they need to read the docs, understand the capabilities and limitations of each option, and select the appropriate solution for their situation. – voretaq7 Dec 30 '11 at 18:45
Ok, I've learned a fair bit today and managed to get everything working, thanks everyone for their help! – igneosaur Dec 31 '11 at 0:45

You should read about Apache virtual hosts.

share|improve this answer

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.