使用 "service nginx start " 无法获得正确的页面,但使用 "nginx" 可以
Can't get correct page by using "service nginx start " but ok by using "nginx"
Os: CentOS-7-x86_64-Minimal-1611
nginx: 1.2.1 (installed by
yum)
php: php7.0.1
我用service nginx start
启动nginx,我得到了403 forbidden
但是当我使用 nginx
时,我得到了正确的页面。
我试过把"nginx.conf",user nginx
改成user root
,然后就不能用service nginx start
了(和service nginx一样restart/stop)
我尝试更改目录的组和用户但失败了。
回滚您在 nginx.conf 中的更改,然后通过 sestatus
或 getenforce
命令检查 SELinux 状态。如果它 returns 通过 setenforce 0
命令强制将 SELinux 设置为宽容模式并检查 nginx。
如果它不起作用,请按如下方式设置您的 nginx 根目录权限:
chown nginx:nginx /path/to/nginx/root/directory
chmod 755 /path/to/nginx/root/directory
Os: CentOS-7-x86_64-Minimal-1611
nginx: 1.2.1 (installed by yum)
php: php7.0.1
我用service nginx start
启动nginx,我得到了403 forbidden
但是当我使用 nginx
时,我得到了正确的页面。
我试过把"nginx.conf",user nginx
改成user root
,然后就不能用service nginx start
了(和service nginx一样restart/stop)
我尝试更改目录的组和用户但失败了。
回滚您在 nginx.conf 中的更改,然后通过 sestatus
或 getenforce
命令检查 SELinux 状态。如果它 returns 通过 setenforce 0
命令强制将 SELinux 设置为宽容模式并检查 nginx。
如果它不起作用,请按如下方式设置您的 nginx 根目录权限:
chown nginx:nginx /path/to/nginx/root/directory chmod 755 /path/to/nginx/root/directory