I use LiipImagineBundle 2.3.1 on Symfony 5.2 but id doesn't create cached files on production environment, throwing a 404. It works just fine on dev.
If I run php bin/console liip:imagine:cache:resolve image.jpg --filter=filter_name
it does create the image so I guess the problem is related to nginx.
nginx version is 1.18.0 PHP version is 7.4.3
liip_imagine.yaml:
liip_imagine:
driver: "gd"
resolvers:
default:
web_path: ~
filter_sets:
cache: ~
avatar:
quality: 75
filters:
thumbnail: { size: [200, 200], mode: outbound }
nginx config:
server {
server_name default_server;
root /var/www/mysite/public;
location / {
try_files $uri @rewrite_framework_symfony;
}
location @rewrite_framework_symfony {
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~* \.(jpg|jpeg|png|gif|ico)$ {
expires 365d;
log_not_found off;
access_log off;
try_files $uri $uri/ /index.php?$query_string;
}
}
Does somebody help me?
I just solved the issue.
/media/cache got the permissions for root and not for www-data, the nginx user.
$ chown -R www-data:www-data media/cache/