碌木 发表于 2015-2-13 03:45:16

【已解决】虚拟机装好centos后直接装lnmp可以用,重启虚拟机就打不开网页了

centos安装在虚拟机内,使用桥接网卡网络模式,宿主机可ssh到centos虚拟机上,代表宿主机和虚拟机是连通的。虚拟机刚装好系统就进去装Lnmp了,装好lnmp后是可以用的,虚拟机重启后就访问不到网页了。
centos 7 minimal不带iptables,所以排除了iptables阻挡80端口的可能性。
虚拟机重启几次,lnmp也restart几次,问题依旧。
真找不出问题在哪了。。。只好厚颜来请教军哥了。
以下都是ssh到虚拟机后执行的,ip确认是正确的# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:a0:31:5d brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/24 brd 192.168.1.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fea0:315d/64 scope link
       valid_lft forever preferred_lft forever

# /root/lnmp status
=========================================================================
Manager for LNMP V1.1,Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org

Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================================
nginx (pid 2500 2499 2498) is running...
php-fpm is runing!
SUCCESS! MySQL running (2816)

# netstat -tanp
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:3306 0.0.0.0:* LISTEN 2816/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2498/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1122/sshd
tcp 0 0 192.168.1.4:22 192.168.1.3:53923 ESTABLISHED 2820/sshd: root@not
tcp 0 0 192.168.1.4:22 192.168.1.3:53890 ESTABLISHED 2293/sshd: root@pts
tcp6 0 0 :::22 :::* LISTEN 1122/sshd

[ 本帖最后由 碌木 于 2015-2-13 03:53 编辑 ]

碌木 发表于 2015-2-13 03:47:00

index.html
Index.php
aaa.txt
这三种文件都无法访问

碌木 发表于 2015-2-13 03:54:41

原来是centos 7 用firewall 代替了 iptables,
firewall-cmd --zone=public --add-port=80/tcp --permanent
加上80端口就可以了
页: [1]
查看完整版本: 【已解决】虚拟机装好centos后直接装lnmp可以用,重启虚拟机就打不开网页了