Rails + Dragonfly + Nginx - 错误的图像根路径
Rails + Dragonfly + Nginx - wrong root path for images
我有 Rails 应用程序使用
gem 'dragonfly-s3_data_store', '~> 1.0.0'
并将资产上传到 S3。
文件上传正常,但随后无法显示。如果我查看日志,我会看到:
*150 open() "/etc/nginx/html/system/images/W1siZiIsIjIwMTUvMDUvMjEvMTgvNDIvNTUvOTEwL3ByZXNzX3Nob3J0LnBuZyJdXQ/press_short.png" failed (2: No such file or directory), client: 173.225.73.29, server: SERVERNAME, request: "GET /system/images/W1siZiIsIjIwMTUvMDUvMjEvMTgvNDIvNTUvOTEwL3ByZXNzX3Nob3J0LnBuZyJdXQ/press_short.png?sha=b4bb5663e1358837 HTTP/1.1", host: "EC2-ADDDRESS", referrer: "http://ec2-XXXX.compute-1.amazonaws.com/"
对于那些可能遇到类似问题的人来说。这都与 Dragonfly 中的 "verify_urls" 相关。
您可以在此主题中找到更多答案:
https://github.com/refinery/refinerycms/issues/2681
基本上你需要为 Dragonfly 添加秘密或关闭 verify_urls(不推荐,因为存在漏洞)。
我有 Rails 应用程序使用
gem 'dragonfly-s3_data_store', '~> 1.0.0'
并将资产上传到 S3。
文件上传正常,但随后无法显示。如果我查看日志,我会看到:
*150 open() "/etc/nginx/html/system/images/W1siZiIsIjIwMTUvMDUvMjEvMTgvNDIvNTUvOTEwL3ByZXNzX3Nob3J0LnBuZyJdXQ/press_short.png" failed (2: No such file or directory), client: 173.225.73.29, server: SERVERNAME, request: "GET /system/images/W1siZiIsIjIwMTUvMDUvMjEvMTgvNDIvNTUvOTEwL3ByZXNzX3Nob3J0LnBuZyJdXQ/press_short.png?sha=b4bb5663e1358837 HTTP/1.1", host: "EC2-ADDDRESS", referrer: "http://ec2-XXXX.compute-1.amazonaws.com/"
对于那些可能遇到类似问题的人来说。这都与 Dragonfly 中的 "verify_urls" 相关。
您可以在此主题中找到更多答案:
https://github.com/refinery/refinerycms/issues/2681
基本上你需要为 Dragonfly 添加秘密或关闭 verify_urls(不推荐,因为存在漏洞)。