我在Symfony 5.2上使用了LiipImagineBundle 2.3.1,但是id没有在生产环境中创建缓存文件,而是抛出一个404。它在dev上运行得很好。
如果我运行php bin/console liip:imagine:cache:resolve image.jpg --filter=filter_name,它确实会创建映像,所以我想这个问题与nginx有关。
nginx版本为1.18.0 PHP版本为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:
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;
}
}有人帮我吗?
发布于 2020-12-15 11:58:47
我刚解决了问题。
/media/cache获得根用户的权限,而不是nginx用户www-data的权限。
$ chown -R www-data:www-data media/cache/https://stackoverflow.com/questions/65171130
复制相似问题