![](/img/trans.png)
[英]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 stat() failed (13: Permission Denied)
好的,所以以前發過一些這個但沒有解決方案可以解決我的問題。
我有網站配置,只是直接的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。
希望有人能幫忙解決這個問題。
李。
你還有這個問題嗎? 這個解釋對我有用 : https : //serverfault.com/a/170263/140684
基本上nginx需要在應用程序路徑上的每個目錄上擁有執行權限。 希望這可以幫助。
對我來說這是因為啟用了selinux,請查看
selinuxenabled && echo enabled || echo disabled
如果啟用嘗試禁用
nano /etc/sysconfig/selinux
SELINUX=disabled
然后
reboot
你有權利用-R嗎?
chown -R nginx /usr/share/nginx/threadtheatre/wordpress/
chmod -R 644 /usr/share/nginx/threadtheatre/wordpress/
如果nginx
托管在Fedora
或RedHat
,請更改SELinux
策略並允許nginx
從路徑/ home / path / site提供服務
chcon -R -t httpd_sys_content_t /home/path/site
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.