2017-03-13 21 views
0

現在、私は、URL操作を介してイメージにアクセスしようとするたびに、laravelイメージ介入パッケージが常に404エラーを返すというエラーが発生しています。nginx 404エラー(laravelイメージ介入)

私のイメージは、 'ストレージ/アプリ/画像' フォルダに格納されている

私のnginxの設定ファイル

:それのような

*1 open() "/home/#####/public_html/dtu-feedback-api/public/imagecache/medium/placeholder1.png" failed (2: No such file or directory) 

ルックをしようとした:ここ

server { 
    listen 80; 

    server_name ######; 
    rewrite ^(.*) http://#####$1 permanent; 
    }server { 
    listen 80; 

    # access_log off; 
    access_log /home/#####/logs/access.log; 
    # error_log off; 
    error_log /home/#####/logs/error.log; 

    root /home/######/public_html/dtu-feedback-api/public; 
    index index.php index.html index.htm; 
    server_name ######; 

    # Custom configuration 
    include /home/######/public_html/dtu-feedback-api/*.conf; 

    location/{ 
      try_files $uri $uri/ /index.php?$query_string; 
    } 
    if (!-d $request_filename) { 
      rewrite  ^/(.+)/$ /$1 permanent; 
    } 

    location ~ \.php$ { 
      fastcgi_split_path_info ^(.+\.php)(/.+)$; 
      include /etc/nginx/fastcgi_params; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_connect_timeout 300; 
      fastcgi_send_timeout 300; 
      fastcgi_read_timeout 300; 
      fastcgi_buffer_size 32k; 
      fastcgi_buffers 8 16k; 
      fastcgi_busy_buffers_size 32k; 
      fastcgi_temp_file_write_size 32k; 
      fastcgi_intercept_errors on; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 
    location ~ /\. { 
      deny all; 
    } 
    location = /favicon.ico { 
      log_not_found off; 
      access_log off; 
    } 
    location = /robots.txt { 
      allow all; 
      log_not_found off; 
      access_log off; 
    } 
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|ttf|woff)$ { 
      gzip_static off; 
      add_header Pragma public; 
      add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
      access_log off; 
      expires 30d; 
      break; 
    } 

    location ~* \.(txt|js|css)$ { 
      add_header Pragma public; 
      add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
      access_log off; 
      expires 30d; 
      break; 
    } 
} 

とログですstorageパスの代わりにimagecacheパスのイメージを探します。

このエラーで私を助けてくれますか、ありがとうございます。

+1

Laravelの作業を開始し、解決策を見つけたが、ルートlaravel方向/公衆からBaseRewrite URLを持っています。 イメージストアパスをパブリックフォルダに移動する必要があると思います。 –

+0

これは、ユーザーがサーバーにアップロードした画像です。「public」に保存する必要はありますか? –

答えて

0

私は

location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|ttf|woff)$ { 
      gzip_static off; 
      add_header Pragma public; 
      add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
      access_log off; 
      expires 30d; 
      break; 
    } 

を削除した後、次に画像リンクが

関連する問題