Q about Vagrant: I'm setting a centos 6.5 in vagrant, I have installed httpd but I can't access website on virtual machine

自作多情 提交于 2019-12-12 02:45:13

问题


I'm setting a centos 6.5 in vagrant as server.

I use private_network setting with IP: 192.168.33.20

I used ip address 192.168.33.20 to access SSH and SFTP on virtual machine.

But only I can't access website by that IP address (192.168.33.20) although I have installed httpd and httpd is running

[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

checking SELinux, it is disabled

# 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

Changing HTTP Port

[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

I cannot access my Web Server from my host


回答1:


Open port 80, go to and write

# vi /etc/sysconfig/iptables

Insert a new line

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

That's all to resolve the problem



来源:https://stackoverflow.com/questions/32812080/q-about-vagrant-im-setting-a-centos-6-5-in-vagrant-i-have-installed-httpd-but

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!