【发布时间】:2019-01-24 09:39:33
【问题描述】:
我收到了一个项目,我正尝试在 Docker 和 NGINX 环境中启动它。但似乎我对 LiipImagine 有一个错误。该项目使用 Symfony 4 和 LIIPImagine 版本 2.0.x-dev。
页面应显示缓存中的图像,例如图像 URL: https://localhost:8443/media/cache/live_feed_message/images/live_feed_message/5c486df1a78fe_lama-750389_960_720.jpg
目录存在且有权限:
drwxr-xr-x 2 1000 1000 4069 Jan 23 13:35 live_feed_message
所有图片都存储在 public/images/live_feed_mesage/ 中,而在 public/media/cache/live_feed_message/images/live_feed_message 中对应的图片不存在。
我发现如果我使用来自 LiipImagine 的命令: php app/console liip:imagine:cache:resolve relative/path/to/image1.jpg
它给出了这个结果:
http://localhost/media/cache/quizz_thumbnail/images/live_feed_message/name_file.jpg
http://localhost/media/cache/quizz_sponsors_icon/images/live_feed_message/name_file.jpg
http://localhost/media/cache/live_feed_message/images/live_feed_message/name_file.jpg
然后对应的图片存在缓存中(public/media/cache/live_feed_message/images/live_feed_message)并且图片在页面上正确显示...
在开发控制台的网络选项卡中,我检查了来自 HTTP 请求的响应。我得到了 Symfony 的回复:
Unable to write to the "/srv/api/public/media/cache/live_feed_message/images/live_feed_message" directory.
有人知道可能是什么问题吗?
2天后我无法解决此问题,感谢您的帮助!
PS:我从捆绑包中覆盖了 routing.yaml 中的路由。 在路径中有 /resolve,我用它覆盖了(实际上我从 liip_imagine_filter 路径中删除了 /resolve):
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.yaml"
liip_imagine_filter:
path: /media/cache/{filter}/{path}
defaults:
_controller: '%liip_imagine.controller.filter_action%'
methods:
- GET
requirements:
filter: '[A-z0-9_-]*'
path: .+
【问题讨论】:
标签: symfony ubuntu caching rights liipimaginebundle