简体   繁体   English

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

[英]Nginx stat() failed (13: Permission Denied)

Okay so there have been some previous posting of this yet no solution fixes my problem. 好的,所以以前发过一些这个但没有解决方案可以解决我的问题。

I have site configured which is just straight up HTML, CSS & JS and I'm trying to add a wordpress site. 我有网站配置,只是直接的HTML,CSS和JS,我正在尝试添加一个wordpress网站。 My config for the wordpress site is as follows. 我对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;
    }

}

This is the error thats in my logs 这是我日志中的错误

"/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 is using the nginx user and likewise for php-fpm. nginx正在使用nginx用户,同样也用于php-fpm。 The nginx directory and all its sub directories have the following permissions. nginx目录及其所有子目录具有以下权限。

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

If I browse to threadtheatre.co.uk on the web i get 404. 如果我在网上浏览threadtheatre.co.uk,我会得到404。

hope someone can help with this. 希望有人能帮忙解决这个问题。

Lee. 李。

Do you still have this problem? 你还有这个问题吗? This explanation worked for me: https://serverfault.com/a/170263/140684 这个解释对我有用https//serverfault.com/a/170263/140684

basically nginx needs to have execution rights on every dir on the path to your app. 基本上nginx需要在应用程序路径上的每个目录上拥有执行权限。 Hope this helps. 希望这可以帮助。

for me this is because selinux enabled, check with 对我来说这是因为启用了selinux,请查看

selinuxenabled && echo enabled || echo disabled

if enabled try to disable 如果启用尝试禁用

nano /etc/sysconfig/selinux
SELINUX=disabled

then 然后

reboot

Have you given permissions with -R? 你有权利用-R吗?

chown -R nginx /usr/share/nginx/threadtheatre/wordpress/
chmod -R 644 /usr/share/nginx/threadtheatre/wordpress/

如果nginx托管在FedoraRedHat ,请更改SELinux策略并允许nginx从路径/ home / path / site提供服务

chcon -R -t httpd_sys_content_t /home/path/site

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有Nginx 1.6.2的CentOS 6.6 - 突然无法重启nginx - nginx:[emerg] open()“/ usr / share / nginx / on”失败(13:权限被拒绝) - CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [emerg] open() “/usr/share/nginx/on” failed (13: Permission denied) nginx 错误连接到 php5-fpm.sock 失败(13:权限被拒绝) - nginx error connect to php5-fpm.sock failed (13: Permission denied) session_start()失败:权限被拒绝(13) - session_start() failed: Permission denied (13) SQLSTATE [HY000]:常规错误:13无法获取“ ./pics”的统计信息(错误代码:13-权限被拒绝) - SQLSTATE[HY000]: General error: 13 Can't get stat of './pics' (Errcode: 13 - Permission denied) 13:使用Nginx在ubuntu 14.06上拒绝php 5.6 fpm的权限 - 13: Permission denied php 5.6 fpm on ubuntu 14.06 with nginx SMTP 错误:无法连接到服务器:权限被拒绝 (13) - SMTP ERROR: Failed to connect to server: Permission denied (13) ftp_rawlist():bind()失败:权限被拒绝(13) - ftp_rawlist(): bind() failed: Permission denied (13) 请求库:无法建立新连接:[Errno 13] 权限被拒绝 - requests library: Failed to establish a new connection: [Errno 13] Permission denied php session_start:失败:权限被拒绝(13) - php session_start: failed: Permission denied (13) 警告:session_start():失败:权限被拒绝(13) - Warning: session_start(): failed: Permission denied (13)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM