Устранение проблем отображения картинок ImageCache в nginx

I couldn't get the ImageCache module for Drupal to work for the longest time because I didn't realize that the module came with a .htaccess file that pushes the image load back through Drupal to calculate the caching properly. Knowing this I was able to find this magical chunk for your nginx.conf (or your virtual host config). Slip this code in near the static serve file command



  1. # imagecache needs to have php read any files that it's planning to manipulate
  2. location ^~ /sites/default/files/imagecache/ {
  3.      index  index.php index.html;
  4.      # assume a clean URL is requested, and rewrite to index.php                                                                 
  5.       if (!-e $request_filename) {
  6.           rewrite  ^/(.*)$  /index.php?q=$1  last;
  7.           break;
  8.       }
  9. }
  11. # serve static files directly
  12. location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
  13.     access_log        off;
  14.     expires           30d;
  15. }