Friday, March 1, 2019

centos - Can View Website on Localhost and By IP on machine but nothing from other machines



I have a centos apache2 webserver which is running and I can view the localhost website from localhost or by http://192.168.0.167 (its IP) through a browser on the machine itself, but if I try to view it by its IP on another machine through a browser on the network I can't load the website. Also pinging the machine from another machine works fine. I'm able to connect to the machine via SSH as well with no trouble.



"iptables -L" output:



Chain INPUT (policy ACCEPT)

target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Answer



In runtime:



iptables -I RH-Firewall-1-INPUT 7 -p tcp --dport 80 -j ACCEPT


startup in /etc/sysconfig/iptables


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...