简体   繁体   English

Apache只能从localhost访问,但不能通过IP或域名访问

[英]Apache only accessible from localhost but not via IP or Domain Name

So I was having problem setting up my Apache and I have it running now. 所以我在设置Apache时遇到了问题,我现在正在运行它。

If you want to see my httpd.conf file or some other info please look at Need help setting up Apache on CentOS 5.5 , getting 403 如果你想查看我的httpd.conf文件或其他一些信息,请查看需要帮助在CentOS 5.5上设置Apache,获得403

I can successfully run lynx localhost and see "It works!" 我可以成功运行lynx localhost并看到“它有效!” however when I try to access the site via the domain name or IP address I do not get anything. 但是,当我尝试通过域名或IP地址访问该网站时,我没有得到任何东西。 Chrome says oops could not connect to blah blah. Chrome说oops无法连接到等等等等。

Here is my iptables -L : https://gist.github.com/875450 这是我的iptables -Lhttps//gist.github.com/875450

Here is my iptables-save : https://gist.github.com/875472 这是我的iptables-savehttps//gist.github.com/875472

So what am doing wrong that I can see it locally but not via the IP? 那么我在本地看到的却是错误的,而不是通过IP?

Thanks 谢谢

You have an issue with your iptables configuration. 你的iptables配置有问题。 The first rule in the INPUT chain is: INPUT链中的第一条规则是:

-A INPUT -j RH-Firewall-1-INPUT

and all other rules in the chain are appended ( -A ) after it. 并在链后附加( -A )所有其他规则。 But the last rule in the RH-Firewall-1-INPUT chain is: RH-Firewall-1-INPUT链中的最后一条规则是:

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

which rejects any connection that has not been accepted previously, including any HTTP connections. 它拒绝任何先前未被接受的连接,包括任何HTTP连接。

You need to insert ( -I ) the HTTP/HTTPS rules to the INPUT chain instead of appending ( -A ) them, so that they are applied first. 您需要将( -I )HTTP / HTTPS规则插入到INPUT链中,而不是附加( -A )它们,以便首先应用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM