美文网首页
[Linux] Win7主机上浏览器不能访问CentOS服务器_

[Linux] Win7主机上浏览器不能访问CentOS服务器_

作者: Fighting_001 | 来源:发表于2018-10-11 16:21 被阅读22次

问题描述:

在物理主机中下载Xshell5,用以连接远程服务器。Xshell可以通过(服务器IP、用户名、密码)连接到CentOS7的服务器;Win7下通过cmd命令行ping虚拟机的IP也可以正常ping通;但是物理主机的浏览器中访问虚拟机的服务器IP,无法连通

检测环境
物理主机:Win7 64bit
虚拟机:VMware 14.x
虚拟机中OS:CentOS7
虚拟机中服务器环境:Apache+MySQL+PHP;Nginx+MySQL+PHP

问题分析

主机的浏览器访问服务器的IP,默认的端口是80端口,可能是服务器的安全策略限制了80端口的开放访问

解决方案

以root权限身份将CentOS7中的防火墙关闭,然后再回到主机浏览器中访问虚拟机的服务器

# 输入root用户的密码切换身份
su -
# 关闭防火墙
systemctl stop firewalld.service
#禁止防火墙开机启动
systemctl disable firewalld.service
【Tips】CentOS中关闭防火墙-操作命令
  • CentOS 6
# 永久性开启,重启后依然保持开启
chkconfig iptables on
# 永久性关闭,重启后依然保持关闭
chkconfig iptables off

# 即时开启防火墙,重启后复原 
service iptables start 
# 即时关闭防火墙,重启后复原
service iptables stop 
  • CentOS 7
#启动防火墙
systemctl start firewalld.service
#关闭防火墙
systemctl stop firewalld.service
#禁止防火墙开机启动
systemctl disable firewalld.service

参考资料:
[1] 本地主机客户端访问不了VMware虚拟机里的服务器
[2] 主机通过浏览器不能访问到虚拟机的web服务器(粗暴版)

相关文章

网友评论

      本文标题:[Linux] Win7主机上浏览器不能访问CentOS服务器_

      本文链接:https://www.haomeiwen.com/subject/iipbaftx.html