问题描述
我已经在我的服务器上安装了 apache,但是我无法通过我的服务器 IP 浏览我的网站.apache 的设置是/var/www/htdocs/下的单个帐户服务器.
I have installed apache on my server however I can not browse my website through my server's IP. the setup of the apache is a single account server under /var/www/htdocs/.
我还需要做什么才能通过我的服务器的 IP 查看帐户吗?
Is there anything else I need to do to be able to see the account via my server's IP?
推荐答案
有几种可能.
- 防火墙、iptables 配置
- apache监听地址/端口
需要有关您的配置的更多信息.你用的是什么发行版?可以通过 127.0.0.1 连接吗?
More information is needed about your configuration. What distro are you using? Can you connect via 127.0.0.1?
如果问题出在防火墙/iptables,您可以在/etc/sysconfig/iptables 中添加以下行:
If the issue is with the firewall/iptables, you can add the following lines to /etc/sysconfig/iptables:
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
(只有https需要第二行)
(Second line is only needed for https)
确保它位于全局限制访问的所有行之上,如下所示:
Make sure this is above any lines that would globally restrict access, like the following:
-A INPUT -j REJECT --reject-with icmp-host-prohibited
在 CentOS 6.3 上测试
Tested on CentOS 6.3
最后
service iptables restart
这篇关于apache 和 httpd 正在运行,但我看不到我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!