Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Say I have two document roots domain1/ and domain2/

I know how to access those two roots from my own computer if they are hosted on the same computer. My question is that if I want to do the same thing on my ec2 server, how should I configure my elastic ips to those two roots? I know by default the elastic ip will only associate to the root with the name localhost(

Anyone could give me a detailed answer? An example would help, thanks!

share|improve this question
Are you trying to do name based or IP based virtual hosting? – mgorven Jun 16 '12 at 18:45
May I know how to do both? Thanks! – Esh Jun 16 '12 at 20:56

Just create 2 virtual hosts on your EC2 instance like:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/domain1
ServerName domain1
ServerAlias www.domain1

# Other directives here


<VirtualHost *:80>
DocumentRoot /www/domain2
ServerName domain2
ServerAlias www.domain2

# Other directives here

share|improve this answer
Say I have for the /www/domain1, and for the /www/domain2. How can I redirect those two www domains to those roots on my ec2? What's the addresses shall I use to point to? – Esh Jun 20 '12 at 22:57

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.