HTTP not working EC2 instance with own domain name

Posted by bogdanvursu on Server Fault See other posts from Server Fault or by bogdanvursu
Published on 2010-10-13T09:42:12Z Indexed on 2011/02/03 7:27 UTC
Read the original article Hit count: 574

Filed under:
|
|

I have this problem I've already posted on the Amazon AWS forum. Unfortunately I haven't got a clear answer I and I was hoping you guys could help. Here's the link: http://developer.amazonwebservices.com/connect/thread.jspa?messageID=198238#198207

Basically I don't know why after associating an Elastic IP address and mapping it to one of my domains, FTP an ping work fine, but HTTP does a 302 redirect to the Amazon AWS hostname I had before associating the Elastic IP address.

Here's the question from the AWS forum: I have an EC2 instance with HTTP and FTP installed. They both worked. Then I associated an Elastic IP address to that instance. Then I mapped that IP address to a name which is a subdomain of a domain I own. I think it's an A name (I didn't do the mapping personally). Now FTP works and HTTP doesn't.

The AWS host name before the Elastic IP association: ec2-184-73-27-8.compute-1.amazonaws.com The AWS IP address and host name after the association: 174.129.7.254 and ec2-174-129-7-254.compute-1.amazonaws.com The domain which is mapped to 174.129.7.254 using an A record is: demo.flashxml.net

FTP works means that I can connect to both 174.129.7.254, ec2-174-129-7-254.compute-1.amazonaws.com and demo.flashxml.net.

HTTP doesn't work means that a HTTP request to 174.129.7.254, ec2-174-129-7-254.compute-1.amazonaws.com or demo.flashxml.net returns a 302 redirect to ec2-184-73-27-8.compute-1.amazonaws.com

Here is my VirtualHost file:

<VirtualHost *:80>
        DocumentRoot /home/ec2-user/public_html/wordpress

        ServerName demo.flashxml.net

        ErrorLog logs/ec2-user-error_log

        <Directory /home/ec2-user/public_html/wordpress>
                AllowOverride FileInfo
                Order Deny,Allow
                Allow from All
        </Directory>
</VirtualHost>

I finally figured out what was wrong. It's the fact that I installed Wordpress on the server using the hostname provided by Amazon. After associating the Elastic IP and updating the DNS records, the server was reachable - FTP working was the proof of that. The 302 redirect when accessing via HTTP was caused by Wordpress's hostname settings.

So, what I've learned from all this was that I should setup my IP and DNS first and only after that install Wordpress or any other web app(s).

© Server Fault or respective owner

Related posts about dns

Related posts about amazon-ec2