【发布时间】:2019-06-21 03:40:41
【问题描述】:
我正在使用拇指和 s3。
我想在他们面前使用清漆。
我知道如何在它们中分别涂上清漆,但我无法将两者结合起来
thumor 的清漆设置
vcl 4.0;
import directors;
backend thumbor1 { .host ="127.0.0.1"; .port="8888"; .max_connections = 200; .connect_timeout = 5s; .between_bytes_timeout = 5s; }
# backend thumbor2 { .host ="127.0.0.1"; .port="9002"; .max_connections = 200; .connect_timeout = 5s; .between_bytes_timeout = 5s; }
acl internal {
"localhost";
"127.0.0.1";
}
sub vcl_init {
new vdir = directors.round_robin();
vdir.add_backend(thumbor1);
# vdir.add_backend(thumbor2);
}
sub vcl_recv {
set req.backend_hint = vdir.backend();
if (req.method == "PURGE") {
if (!client.ip ~ internal) {
return (synth(405, "This IP is not allowed to send PURGE requests."));
}
return (purge);
}
if (req.url ~ "\?$") {
set req.url = regsub(req.url, "\?$", "");
}
return (hash);
}
s3 的清漆设置
vcl 4.0;
backend default
{
.host = "my.bucket.s3.amazonaws.com";
.port = "80";
}
sub vcl_backend_fetch
{
set bereq.http.Host = "my.bucket.s3.amazonaws.com";
set bereq.http.Date = now;
}
我希望最终结果是这样的
client => varnish => thumbor => s3 (thumbnail image)
client => varnish => s3 (normal image)
【问题讨论】:
标签: varnish varnish-vcl thumbor