sestatus
若是不是 disables , 须要php
vi /etc/selinux/config
将之前的 SELINUX=enforcing 改成 SELINUX=disabled ,以下所示html
# 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=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
保存后,reboot重启系统便可。linux
注:这是个大坑!!!至于SELinux是什么请自行百度:)nginx
例如网站根目录为 /var/www/html/ , 首页文件为 /var/www/html/index.htmlbash
除了index.html文件根据需求设置权限,例如网站
chmod 644 /var/www/html/index.html
必须将这个文件所在的目录设置为有 读 和 操做 的权限spa
chmod -R 755 /var/www/html
注: 这个没多大乱用,几乎全部的文件(夹)都符合须要的权限。code
这个就不详细举例了,细心点不会在这里犯错的,htm
在nginx配置文件里按须要写上主页名,别忘了后面的分号就行。blog
index index.php index.html;
------------------------PS--------------------------
这个问题没把我急死,文件权限修改了无数次怎么也不行,终于发现是SELinux的锅,既然暂时用不到这个东东,就将它禁用~~~
或许更改用户组权限也能够解决这个问题,留待心情好了再看看~
________________END________________