0

我在 vagrant 中设置了一个 centos 6.5 作为服务器。

我使用带有 IP 的 private_network 设置:192.168.33.20

我使用 ip 地址 192.168.33.20 在虚拟机上访问 SSH 和 SFTP。

但只有我无法通过该 IP 地址(192.168.33.20)访问网站,尽管我已经安装了 httpd 并且 httpd 正在运行

[root@centos65 ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:45525               0.0.0.0:*                   LISTEN      1082/rpc.statd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1208/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1285/master
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1062/rpcbind
tcp        0      0 :::22                       :::*                        LISTEN      1208/sshd
tcp        0      0 ::1:25                      :::*                        LISTEN      1285/master
tcp        0      0 :::34314                    :::*                        LISTEN      1082/rpc.statd
tcp        0      0 :::111                      :::*                        LISTEN      1062/rpcbind
tcp        0      0 :::80                       :::*                        LISTEN      3202/httpd

检查 SELinux,它被禁用

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

更改 HTTP 端口

[root@centos65 ~]# sudo netstat -nltd
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:49655               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
tcp        0      0 ::1:25                      :::*                        LISTEN
tcp        0      0 :::45389                    :::*                        LISTEN
tcp        0      0 :::111                      :::*                        LISTEN
tcp        0      0 :::8080                     :::*                        LISTEN

我无法从我的主机访问我的 Web 服务器

4

1 回答 1

-2

打开80端口,去写

# vi /etc/sysconfig/iptables

插入新行

-A INPUT -p tcp -m state –state NEW –dport 80 -j ACCEPT

这就是解决问题的全部

于 2015-09-29T14:04:01.343 回答