主机连接虚拟机 web服务

主机上安装了个VM centeros 

首先通过 终端:ifconfig eth0 查看虚拟机的Ip地址

这样就能在主机上通过浏览器http://192.168.150.128/a.php 访问虚拟机的web服务了

telnet 192.168.150.128 80 失败判断为80端口未开放

修改防火墙规则

[root@jiangbo ~]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@jiangbo ~]# /etc/rc.d/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables:     [确定]
[root@jiangbo ~]# /etc/init.d/iptables restart
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
[root@jiangbo ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:3A:B6:53  
          inet addr:192.168.150.128  Bcast:192.168.150.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe3a:b653/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:310837 errors:0 dropped:0 overruns:0 frame:0
          TX packets:112606 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:389046032 (371.0 MiB)  TX bytes:9175743 (8.7 MiB)

 Can't start server: Bind on TCP/IP port: Permission denied 

/etc/my.cnf 修改mysql端口号

gnome-open为打开文件命令 如gnome-open /etc/php.ini  可以在终端直接打开

修改linux下mysql端口时候报错:Can't start server: Bind on TCP/IP port: Permission denied

需要修改: vi /etc/selinux/config

SELINUX=disabled 

然后重启服务器即可

posted on 2016-07-12 10:41  防空洞123  阅读(407)  评论(0编辑  收藏  举报

导航