你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

解决初次安装PHP后搭配Nginx报404问题

2021/12/8 19:44:15

在虚拟机上安装成功Nginx和PHP,并配置完成后,发现访问域名出现 404。

最终找到的问题有两个:

1、centos7  的防火墙功能未关闭,先关闭防火墙

systemctl status firewalld.service 

        取消防火墙的开启自启功能

systemctl disable firewalld

2、需要关闭 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=targeted

        2.2、或者临时关闭

 setenforce 0

        2.3、重启linux系统,查看selinux的状态,都为禁用状态

[root@centos7]# getenforce 
Disabled

或

[root@centos7~]# sestatus
SELinux status:                 disabled
[root@centos7~]# 

3、以上操作完成后,重新访问页面,成功。