Problem/Motivation

Not displaying and generating image styles on the website using Nginx as the web server. After quite of debugging seems that issue is not having proper rewrites for the custom path which is used for retrieving image styles from S3.

    location ~ ^/s3/files/styles/ {
            try_files $uri @rewrite;
    }

Proposed resolution

Updating README.txt with instructions and example of rewrite for Nginx webserver.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 image_styles_nginx-2974302.patch731 bytesvalic

Comments

valic created an issue. See original summary.

valic’s picture

Status: Active » Needs review
StatusFileSize
new731 bytes

Patch attached to update README.txt with instructions.

Status: Needs review » Needs work

The last submitted patch, 2: image_styles_nginx-2974302.patch, failed testing. View results

bandanasharma’s picture

Status: Needs work » Reviewed & tested by the community

@valic patch is apply successfully and change reflected on the file.

jansete’s picture

Issue tags: +alpha target

  • jansete committed fbb77d1 on 8.x-3.x authored by valic
    Issue #2974302 by valic, bandanasharma: Image styles issues on Nginx web...
jansete’s picture

Status: Reviewed & tested by the community » Fixed

Added to dev branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dawid_nawrot’s picture

@valic Oh lord, I've been searching for fix of this issue forever, I've debugged half of the module and it took me 2 days.

delzhand’s picture

A tip for anyone using the Drupal recipes in lando - location directives in nginx have a priority system, and this won't work if it's the last location directive. I'm not an nginx config expert, but I think this one competes with it:

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
      expires max;
      log_not_found off;
  }

So as long as the necessary S3FS config is listed before that one, it should work.