Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am having this problem accessing my elastic public IP for my EC2 instance in the web browser. Installed REDHAT 6.3 and installed nginx web server(up and running) and also made sure i enabled port 80 and everything needed was setup.

Now time to enter the public IP to view the default nginx web page and nothing happens. I couldn't access the IP address.

Now i could ping other websites but couldn't ping my IP address.

Now after several hours of trying and trying to figure out what was going on...i figured i should check the networking on the REDHAT OS and whenever i try to edit anything network related..that is it i lost connection to the server and cannot restart the network.

What am i getting wrong here? Why is just accessing my server through IP such a difficult thing? What do i need to do now?

Thanks.

EDIT. here is the security group associated with the EC2 instance

Ports   Protocol    Source
20-21   tcp 0.0.0.0/0   
22  tcp 0.0.0.0/0   
80  tcp 0.0.0.0/0   
14000-14050 tcp 0.0.0.0/0
share|improve this question
    
Ping isn't enabled by default, nor is port 80 in the AWS security group. What's your AWS Security Group for this instance look like? –  Jason Floyd Jan 9 '13 at 16:36
    
@jason-floyd it is posted in the question..under EDIT. –  redhatengineer6 Jan 9 '13 at 17:49
    
Are you using VPC or a simple EC2 instance ? –  GeekRide Jan 10 '13 at 7:59
    
@geekride i am using EC2 instance –  redhatengineer6 Jan 10 '13 at 8:33
    
Can you please paste the output of telnet IP 80 over here. –  GeekRide Jan 11 '13 at 7:40

5 Answers 5

up vote 1 down vote accepted

So, There are be few things which might be wrong here. You can test them one by one and zero down to the issue.

  1. First check whether you are able to connect to the port from outside. To do that, use this command

    # telnet IP 80
    

    If you are able to connect through this, then it means there is something surely wrong with your WebServer settings and you shouldn't be looking at the next rules.

  2. If first one doesn't work, the second thing to check is your iptables in your machine, not just the AWS security group. To do the same, check the output of this command.

    # iptables -L -n
    

    The default policies should always be ACCEPT, if you are not specifically putting then to DROP or REJECT. To test whether iptables is the issue or not, you can try disabling iptables by flushing the rules or stopping your iptables service.

    To flush the rules, use this command:

    # iptables -F
    

    To stop the iptables service:

    # service iptables stop
    

    Now try to access your site.

  3. The third option is to check the Selinux on your machine. On redhat machine, SElinux is by default enabled. To check the same, use this command and check for the status:

    # getsebool
    

    It should say something like this:

    getsebool:  SELinux is disabled
    

    If it's enabled, then it could be the cause. Just try disabling it temporarily with this command:

    # setenforce 0
    

    This will disable the SElinux on your machine on temporarily basis. If this fixes your issue, just update the state from Enforcing to disabled in /etc/sysconfig/selinux and it will disable SElinux at your machine permanently.

Hope this helped.

share|improve this answer
    
i have fixed this..i found out since i was using RedHat 6..by default port 80 wasn't open so i had to edit the iptables to include port 80...even with the security group i still needed to do this..thanks. –  redhatengineer6 Jan 11 '13 at 15:39
    
Glad it helped. –  GeekRide Jan 11 '13 at 18:35

If it's just web traffic and you can still ssh to your instance, then it's almost certainly something to do with your configuration of nginx.

share|improve this answer
    
nginx is configured properly...i am 100% sure about that. –  redhatengineer6 Jan 9 '13 at 17:47

Have you edited the security groups firewall to allow ssh web traffic etc?
the default security group firewall is pretty harsh.

from yourEC2 console

Network & security -> Security groups -> default -> inbound

can choose a template rule from the dropdown or create a custom one.

add rule -> apply rule changes

changes should be almost instant

share|improve this answer
    
yes i have a security setup myself with the following open 20-21 tcp 0.0.0.0/0 22 tcp 0.0.0.0/0 80 tcp 0.0.0.0/0 14000-14050 tcp 0.0.0.0/0 –  redhatengineer6 Jan 9 '13 at 8:39
    
Ok, can you ssh to the default public dns name associated with the instance? –  peteches Jan 9 '13 at 9:00
    
yes with putty..that's how i am able to run command line codes –  redhatengineer6 Jan 10 '13 at 8:33

Besides your AWS Security group settings to allow port 80, check your Redhat firewall as well. Port 80 isn't open by default.

On your redhat system run system-config-firewall-tui to get the firewall configuration util for redhat open, then allow the http port 80 access.

share|improve this answer

GeekRide did a great job of highlighting different troubleshooting steps. The answer for my deployment was related to the iptables. Stopping the service is a great tip to quickly identify the issue.

To solve the issue, be sure to "insert" your port into the table. Do not append, as you will most likely be appending after a "reject all" entry that is at the end of the list. This example uses 5 to be placed after the port 22 rule. In aws since you connect as ec2-user, add the sudo command.

# sudu su
# iptables -L -n
# iptables -I INPUT 5 -p tcp --dport XXXXX -j ACCEPT

If that works, be sure to save in case the iptables service is restarted

# iptables-save
share|improve this answer

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.