-
Notifications
You must be signed in to change notification settings - Fork 0
/
images.conf
64 lines (61 loc) · 1.95 KB
/
images.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
proxy_cache_path /var/www/cache/nginx_cache levels=1:2 keys_zone=nginx_cache:100M max_size=1G inactive=40d;
log_subrequest on;
server {
listen 3001;
server_name image_resize_server;
location ~ ^/img/c/([0-9]+)x([0-9]+)/(.+) {
image_filter_buffer 50M;
image_filter crop $1 $2;
image_filter_interlace on;
image_filter_webp_quality 95;
image_filter_jpeg_quality 95;
image_filter_transparency on;
image_filter_sharpen 20;
rewrite ^ $request_uri;
rewrite ^/img/c/([0-9]+)x([0-9]+)/(.*) $3 break;
return 400;
proxy_pass http://127.0.0.1:3002/img/$uri;
}
location ~ ^/img/r/([0-9]+)/(.+) {
image_filter_buffer 50M;
image_filter resize $1 -;
image_filter_webp_quality 95;
image_filter_jpeg_quality 95;
image_filter_transparency on;
image_filter_sharpen 20;
image_filter_interlace on;
rewrite ^ $request_uri;
rewrite ^/img/r/([0-9]+)/(.*) $2 break;
return 400;
proxy_pass http://127.0.0.1:3002/img/$uri;
}
}
server {
listen 3002;
server_name s3_image_proxy;
resolver 8.8.8.8 8.8.4.4;
resolver_timeout 60s;
set $backend 'REPLACE_THIS_WITH_YOUR_BUCKET_URL';
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass_request_body off;
proxy_pass_request_headers off;
proxy_hide_header "x-amz-id-2";
proxy_hide_header "x-amz-request-id";
proxy_hide_header "x-amz-storage-class";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Set-Cookie";
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
location ~ ^/img/(.+) {
rewrite ^ $request_uri;
rewrite ^/img/(.*) $1 break;
return 400;
proxy_pass http://$backend/$uri;
proxy_cache nginx_cache;
proxy_cache_key "temp_$proxy_host$uri$is_args$args";
proxy_cache_valid 90d;
expires 90d;
}
}