2015-03-03 93 views
2

好吧,所以有一些此前的發佈,但沒有解決方案修復我的問題。Nginx的統計()失敗(13:權限被拒絕)

我有站點配置,這是隻是直線上來,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

希望有人能夠幫助這一點。

Lee。

+0

正在使用什麼操作系統? – givanse 2015-07-24 09:15:45

回答

5

對我來說,這是因爲啓用SELinux的,請與

selinuxenabled && echo enabled || echo disabled 

如果允許嘗試禁用

nano /etc/sysconfig/selinux 
SELINUX=disabled 

然後

reboot 
0

您是否賦予-R權限?

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

是的,它仍然會產生相同的錯誤。 – 2015-03-03 14:08:13

7

你還有這個問題嗎?這個解釋適用於我: https://serverfault.com/a/170263/140684

基本上nginx需要在你的應用程序的路徑上的每個目錄的執行權。希望這可以幫助。

+0

這也適用於我。反直覺的(我認爲讀取權限已足夠,但nginx需要'+ x'作爲目錄)。 – 2016-01-11 22:17:27

+3

這不是特定的nginx,它是一個通用的linux的東西(甚至對於unix,不知道)。目錄上的權限與文件有所不同。目錄的「x」位稱爲搜索位,並且需要能夠進入該目錄並訪問其中的文件和目錄。你可以通過創建一個目錄來嘗試自己,刪除'x'位('chmod a-x

'),然後嘗試'cd'進入它。 – Plenka 2016-03-11 13:53:02

+0

相關知識 - 謝謝! – meta 2016-03-11 14:58:02

相關問題