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.

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(127.0.0.1).

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

1 Answer 1

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>

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

# Other directives here

</VirtualHost>
share|improve this answer
    
Say I have www.domain1.com for the /www/domain1, and www.domain2.com 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

 
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.