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.

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

share|improve this question
add comment

3 Answers

First of all double posting is not very good etiquite, and making people go offsite to find your question just makes it worse. Please consider editing your question to actually be self contained here, then make SURE you update both sites with any developments and the answer once you figure it out.

Secondly, there really isn't enough information here to figure out what you've done wrong. The suggestion on the AWS forum is a good one. You seem to still be doing some things with the IP and host records from before your elastic ip was assigned. When you do that assignment your host name and ip will change! However you need to elaborate your configuration. What does your DNS look like? What domain are you trying to connect to and what does it get "forwarded to"? Are we talking about ec2 host name domains or a custom domain of your own? If the former you are just using the wrong address. If the latter your DNS records are not entered properly. They should be CNAME's to your elastic ip host name so that proper internal vs external addresses are returned.

share|improve this answer
    
I know it's bad etiquette, I just thought I should get a second opinion. Providing the link was easier than copying the whole text. Anyway, I will edit my initial question and hopefully I will get an answer that actually fixes my problem. –  bogdanvursu Oct 13 '10 at 11:04
    
Easier for you doesn't mean easier for the volunteer you are trying to get to solve your problem for free. Good forum etiquette would have you do as much of the work as possible to make it easy on your answers. Do try posting more details about your configuration including dns zone files for your domain so that we can trouble shoot without guessing. –  Caleb Oct 13 '10 at 11:08
    
This seems like a DNS problem, but I don't think it is, since FTP does work. Anyway, I will post the DNS zones as soon as I get access to them. –  bogdanvursu Oct 13 '10 at 11:31
    
Have you gotten a look at the DNS zone configs yet? Also is it possible that your ftp and http clients are using a different DNS resolvers? For example a browser that was configured with a proxy or some sort of third party dns access might bypass the system configured dns resolver that your ftp client is picking up on. Also it's possible to specify different lookups for different service requests. I noticed the other day google's hosted apps service uses this to redirect jabber traffic to their servers even when a the used jabber domain A record points elsewhere! –  Caleb Oct 15 '10 at 10:47
add comment

It may be that you are using one of the Amazon services that requires the dns record to be a CNAME and not an A.

I have fielded inquiries recently about using multiple amazon presences against geodns and the clients have said that amazon services stipulate the use of CNAME rather than A.

This is because the endpoint is subject to change so the only safe way to do it is with a CNAME record that references the amazon A record that amazon may change on the fly.

They have been specifically told that looking up the ip and using it in an A is not going to work.

share|improve this answer
    
Thanks for your reply. I still haven't been able to find out exactly how the DNS was mapped, but when I do, I will post it. However, I don't understand why FTP works fine, and HTTP doesn't. –  bogdanvursu Oct 14 '10 at 7:17
add comment

I had the same problem and found the solution:

  1. Check if you can access http from localhost. curl http://localhost
  2. Check Security Groups on AWS EC2, to ensure that you are accepting traffic on port 80.
  3. Last but not least check firewall settings in your EC2 instance.
share|improve this answer
add comment

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.