Thursday, November 1, 2012
[SOLVED] My website is unreachable but SSH still works Centos Linux
Hi all,
if suddenly your websites becomes unavailable
If you could reach your IP but not your website, then there's something wrong - maybe - with DNS configuration or FIREWALL rules.
If you reviewed your DNS configuration and you tried to restart dns service through:
service named restart
with no success, maybe the problem could be the linux firewall iptables.
So, type these 2 line into your bash
service iptables stop
nano /etc/sysconfig/iptables
To check if the server accept incoming connection on the 80 port and 443 port (http and https) you have to verify the iptables config files in /etc/sysconfig/iptables.
# Generated by iptables-save v1.4.7
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:2600]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed
If port 80 and 443 not exists you have to add these two lines to your VPS iptables config file and it will accept new incoming connection.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Now type in your console:
service iptables start
Now you could check if your website is again available and reachable through the 80 and 443 port.
This works fine on RedHat Centos Linux distribution.
If you have problem listing your directory via FTP so type this in your ssh:
Stay tuned.
if suddenly your websites becomes unavailable
s
or unreachables instead your IP/SSH still works than you could try this tricks that works for me in some situations on redhat Centos.If you could reach your IP but not your website, then there's something wrong - maybe - with DNS configuration or FIREWALL rules.
If you reviewed your DNS configuration and you tried to restart dns service through:
service named restart
with no success, maybe the problem could be the linux firewall iptables.
So, type these 2 line into your bash
service iptables stop
nano /etc/sysconfig/iptables
To check if the server accept incoming connection on the 80 port and 443 port (http and https) you have to verify the iptables config files in /etc/sysconfig/iptables.
# Generated by iptables-save v1.4.7
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:2600]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed
If port 80 and 443 not exists you have to add these two lines to your VPS iptables config file and it will accept new incoming connection.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Now type in your console:
service iptables start
Now you could check if your website is again available and reachable through the 80 and 443 port.
This works fine on RedHat Centos Linux distribution.
If you have problem listing your directory via FTP so type this in your ssh:
iptables -A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
Stay tuned.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment