加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Nginx stat()失败(13:权限被拒绝)

发布时间:2020-12-13 22:11:12 所属栏目:PHP教程 来源:网络整理
导读:好的,所以以前发过一些这个但没有解决方案可以解决我的问题. 我有网站配置,只是直接的HTML,CSS JS和我正在尝试添加一个wordpress网站.我对wordpress网站的配置如下. #######################server {listen 80;root /usr/share/nginx/threadtheatre/wordpres
好的,所以以前发过一些这个但没有解决方案可以解决我的问题.

我有网站配置,只是直接的HTML,CSS& JS和我正在尝试添加一个wordpress网站.我对wordpress网站的配置如下.

#######################

server {
listen 80;

root /usr/share/nginx/threadtheatre/wordpress;
index index.php;
server_name threadtheatre.co.uk;

access_log   /var/log/nginx/thread.access.log;
    error_log    /var/log/nginx/thread.error.log;

location / {

            # try_files $uri $uri/ =404;
            try_files $uri $uri/ /index.php?q=$uri&$args;
}
    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
    }

    location ~ .php${
            try_files $uri =404;
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass unix:/var/run/php-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

}

这是我日志中的错误

"/usr/share/nginx/threadtheatre/wordpress/index.php" failed (13: Permission denied),client: 109.155.53.189,server: threadtheatre.co.uk,request: "GET / HTTP/1.1",host: "threadtheatre.co.uk"

nginx正在使用nginx用户,同样也用于php-fpm. nginx目录及其所有子目录具有以下权限.

drwxrwxr-x.  3 root nginx  4096 Feb  8 18:23 ..

如果我在网上浏览threadtheatre.co.uk,我会得到404.

希望有人能帮忙解决这个问题.

李.

解决方法

对我来说这是因为启用了selinux,请查看

selinuxenabled && echo enabled || echo disabled

如果启用尝试禁用

nano /etc/sysconfig/selinux
SELINUX=disabled

然后

reboot

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读