无法访问 CentOS httpd
Couldn't access CentOS httpd
我一直在使用 Ubuntu,最近才开始在我桌面上的 VMplayer 中使用 Centos(CentOS Linux 版本 7.1.1503(核心))运行(Ubuntu).
- B运行ch 新的 CentOS 安装。
- 已安装 httpd(使用 "yum")
由于某种原因,httpd没有自动启动,我运行"service httpd start"按照"netstat -antp".
启动
[root@localhost ~]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1161/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1620/master
tcp 0 0 10.0.0.19:22 10.0.0.7:20383 ESTABLISHED 2421/sshd: root@pts
tcp6 0 0 :::80 :::* LISTEN 2453/httpd
tcp6 0 0 :::22 :::* LISTEN 1161/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1620/master
我可以在本地访问http服务器(curl http://localhost
在CentOs命令行中)
- 当我尝试从主机
curl http://172.16.13.143/
访问 httpd 时,它拒绝了 TCP 连接。我能够通过 ssh 进入它,它对 ssh ssh root@172.16.13.143
工作正常。
- 我已经停止了 iptables
service iptables stop
- SELinux根据
getenforce
命令关闭
我只需要在网络界面上做一个快速测试,但我做不到。真的需要一些帮助。谢谢。
安装在 RHEL/CentOS/Fedora 系统上的包不应该自动启动任何服务(因为可能在配置完成之前您还没有准备好向世界公开您的服务)。
运行ning service httpd start
会暂时启动服务,下次开机不会启动。您希望 systemctl enable httpd
使该服务在您启动系统时自动启动。
您可以检查一下防火墙是否真的被禁用了。 运行 iptables -S
查看当前规则集。默认的 iptables 配置通常只允许 ssh
而不允许其他任何东西。
更新
您的系统可能 运行正在 firewalld
管理防火墙。试试 service firewalld stop
.
您可以运行 systemctl disable firewalld
阻止它在您的系统下次启动时启动。
您是否做了 iptables -L
以确保没有防火墙 运行?
执行以下命令以确保没有其他防火墙 运行
ps -ef
正在收听“80”,因此某些东西正在阻止您的连接看起来像
-- 中央操作系统 7
将以下内容添加到“/etc/httpd/conf/httpd.conf”
Replace:
Listen 80
With:
Listen 0.0.0.0:80
这将禁用 ipv6 并启用 ipv4
要检查此类型:
netstat -an | grep -i tcp | grep -i listen
重启apache服务
systemctl restart httpd.service
另外,开启防火墙访问80端口
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
在标准安装中,CentOS 7 设置为阻止到 Apache 的流量。
将端口添加到您的防火墙:
对于 http:
sudo firewall-cmd --permanent --add-port=80/tcp
对于 https:
sudo firewall-cmd --permanent --add-port=443/tcp
我一直在使用 Ubuntu,最近才开始在我桌面上的 VMplayer 中使用 Centos(CentOS Linux 版本 7.1.1503(核心))运行(Ubuntu).
- B运行ch 新的 CentOS 安装。
- 已安装 httpd(使用 "yum")
由于某种原因,httpd没有自动启动,我运行"service httpd start"按照"netstat -antp".
启动[root@localhost ~]# netstat -antp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1161/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1620/master tcp 0 0 10.0.0.19:22 10.0.0.7:20383 ESTABLISHED 2421/sshd: root@pts tcp6 0 0 :::80 :::* LISTEN 2453/httpd tcp6 0 0 :::22 :::* LISTEN 1161/sshd tcp6 0 0 ::1:25 :::* LISTEN 1620/master
我可以在本地访问http服务器(
curl http://localhost
在CentOs命令行中)- 当我尝试从主机
curl http://172.16.13.143/
访问 httpd 时,它拒绝了 TCP 连接。我能够通过 ssh 进入它,它对 sshssh root@172.16.13.143
工作正常。 - 我已经停止了 iptables
service iptables stop
- SELinux根据
getenforce
命令关闭
我只需要在网络界面上做一个快速测试,但我做不到。真的需要一些帮助。谢谢。
安装在 RHEL/CentOS/Fedora 系统上的包不应该自动启动任何服务(因为可能在配置完成之前您还没有准备好向世界公开您的服务)。
运行ning service httpd start
会暂时启动服务,下次开机不会启动。您希望 systemctl enable httpd
使该服务在您启动系统时自动启动。
您可以检查一下防火墙是否真的被禁用了。 运行 iptables -S
查看当前规则集。默认的 iptables 配置通常只允许 ssh
而不允许其他任何东西。
更新
您的系统可能 运行正在 firewalld
管理防火墙。试试 service firewalld stop
.
您可以运行 systemctl disable firewalld
阻止它在您的系统下次启动时启动。
您是否做了 iptables -L
以确保没有防火墙 运行?
执行以下命令以确保没有其他防火墙 运行
ps -ef
正在收听“80”,因此某些东西正在阻止您的连接看起来像
-- 中央操作系统 7
将以下内容添加到“/etc/httpd/conf/httpd.conf”
Replace:
Listen 80
With:
Listen 0.0.0.0:80
这将禁用 ipv6 并启用 ipv4
要检查此类型:
netstat -an | grep -i tcp | grep -i listen
重启apache服务
systemctl restart httpd.service
另外,开启防火墙访问80端口
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
在标准安装中,CentOS 7 设置为阻止到 Apache 的流量。
将端口添加到您的防火墙:
对于 http:
sudo firewall-cmd --permanent --add-port=80/tcp
对于 https:
sudo firewall-cmd --permanent --add-port=443/tcp