Drupal 7 images problem

demon326's picture

Okay, the problem is simple: images generated by drupal 7's image system in nodes won't show up and i'm getting pissed because it won't work, even with all the info here...

Setup:
Nginx(80)--->apache(8080)(php backend)

Image part in the vhost:

location @rewrite {
    proxy_pass  http://mydomain.tld:8080/index.php?q=$uri;
}



## Drupal 7 generated image handling, i.e., imagecache in core. See:
    ## https://drupal.org/node/371374.
    location ~* /files/styles/ {
        access_log off;
        expires 30d;
        try_files $uri @rewrite;
    }

What ever i do, it just won't work.....

Comments

Probably

perusio's picture

you have a another location that is matching the request. Have you tried requesting the images file directly from the backend?

Unless you post all the config we can't go much further. Also a debug log can show you exactly what's going on: http://nginx.org/en/docs/debugging_log.html.

Got it fixed already.... I

demon326's picture

Got it fixed already....

I know the code is propbly not the best, but it works:

location ^~ /files/styles/ {
            index  index.php index.html;
                if (!-e $request_filename) {
                    rewrite ^/(.*)$ http://mydomain.tld:8080/$1 last;
                    break;
                }
}

(sorry, not posting real url, can't take change it gets indexed with the apache port)

Hi Perusio. I'm also having

phreestilr's picture

Hi Perusio. I'm also having issues getting image styles to work with my nginx config (posted at http://groups.drupal.org/node/273378).

In the above, you mentioned trying to request the image files directly from the backend. How would you go about doing that?

Thanks!

Well

perusio's picture

that's a really awful Nginx configuration :)

The break is bogus, since there's no other rewrite phase directive in this location.
There's nothing to break from.

If it works with this config it means that you've got another location that matches the filename and that makes imagecache non functional with the previous config I suspect.

Do not create images styles

jyr's picture

Hey,

When I try new content with a image, the image style is not created.I have 775 files permissions, clear cache, restarted nginx and php-fpm and I have the same config

location ~* files/styles {
    access_log off;
    expires 30d;
    try_files $uri @rewrite;
  }

location @rewrite {
    rewrite ^ /index.php last;
}

Log nginx

"GET /sites/blog.com/files/styles/medium/public/field/image/likehome.jpeg

But, I dont have "field" directory in "/sites/blog.com/files/styles/medium/public/", just have "modules" directory.

In Report status I have "Su servidor no puede mostrar el progreso de subida de archivos. Para ello necesita que el servidor web Apache se esté ejecutando con mod_php."

I dont understand. Any tips?

Hello, try : Catch image

angeloo's picture

Hello,

try :

Catch image styles

location ^~ /sites/default/files/styles/ {
    if (!-e $request_filename) {
        rewrite  ^/(.*)$  /index.php?q=$1  last;
        break;
    }
}

this worked

jyr's picture

Hey Angelo,

This worked for me, just changes "location ~* files/styles" for "location ^~ /sites/blog.com/files/styles/"

Thanks a lot!!!

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: