在虚拟机上安装成功Nginx和PHP,并配置完成后,发现访问域名出现 404。
最终找到的问题有两个:
1、centos7 的防火墙功能未关闭,先关闭防火墙systemctl status firewalld.service
取消防火墙的开启自启功能
systemctl disable firewalld2、需要关闭 SELinux 2.1、永久关闭 SELinux。
vim /etc/selinux/config # 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 - No SELinux policy is loaded. # 开启状态 #SELINUX=enforcing # 设置为禁用状态 SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted2.2、或者临时关闭
setenforce 02.3、重启linux系统,查看selinux的状态,都为禁用状态
[root@centos7]# getenforce Disabled 或 [root@centos7~]# sestatus SELinux status: disabled [root@centos7~]#3、以上操作完成后,重新访问页面,成功。



