2012-03-29 7 views
1

私はレール3.0.3アプリでNginx + Unicornを使用しています。ここでリクエストイメージが返る403/404

はアプリのための私のnginxの設定です:ここで

upstream unicorn { 
    server unix:/tmp/unicorn.myapp.sock fail_timeout=0; 
} 

server { 
    listen 80 default deferred; 
    root /home/deployer/apps/myapp/current/public; 

    try_files $uri/index.html $uri @unicorn; 
    location @unicorn { 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_redirect off; 
    proxy_pass http://unicorn; 
    } 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

、アプリのpublic/imagesのディレクトリ一覧です:

lrwxrwxrwx 1 deployer admin  56 2012-03-28 17:06 other -> /home/deployer/other_images/ 
-rw-rw-r-- 1 deployer admin 6646 2012-03-28 17:08 rails.png 

あなたはotherがシンボリックリンクで見ることができるように。ここでは、ブラウザで/home/deployer/other_images/

-rw-r--r-- 1 deployer admin 2271 2012-02-03 17:24 1.jpg 

のためのディレクトリのリストだ、私はhttp://<domain>/images/rails.pngを引き上げることができますが、http://<domain>/images/other/1.jpgpublic/404.htmlページ(「あなたが探していたページは存在しません」)戻っています。

私は間違っていますか?ファイル/ディレクトリの1つにアクセス権の問題がありますか?私のnginx設定は正しく設定されていませんか?

UPDATE

私は(root以下)アプリのnginxの設定ファイルに以下を追加し、1.jpgを要求すると、私は戻って403許可を得る拒否されました:

location ^~ /images/ { 
    gzip_static on; 
    expires max; 
    add_header Cache-Control public; 
} 

答えて

0

私はそれを修正。 /home/deployer/other_imagesディレクトリに読み取りアクセス権がありませんでした。

関連する問題