-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathdefault.conf
68 lines (61 loc) · 1.75 KB
/
default.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
65
66
67
68
proxy_cache_path /data keys_zone=${CACHE_NAME}:${MEMORY_SIZE} inactive=${INACTIVE_TIME} max_size=${CACHE_SIZE};
server {
listen 8888;
allow 127.0.0.1;
deny all;
access_log /var/log/nginx/resizer.log main;
# Clean up the headers going to and from S3.
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";
location ~ ^/([0-9]+)/(.*)$ {
set $width $1;
set $path $2;
rewrite ^ /$path break;
proxy_pass ${IMAGE_HOST};
image_filter resize $width -;
image_filter_buffer 100M;
image_filter_jpeg_quality ${JPG_QUALITY};
}
location ~ ^/([0-9]+)x([0-9]+)/(.*)$ {
set $width $1;
set $height $2;
set $path $3;
rewrite ^ /$path break;
proxy_pass ${IMAGE_HOST};
image_filter resize $width $height;
image_filter_buffer 100M;
image_filter_jpeg_quality ${JPG_QUALITY};
}
}
server {
listen 80 default_server;
server_name ${NGINX_HOST};
access_log /var/log/nginx/proxy.log main;
add_header X-Cache-status $upstream_cache_status;
location ~ ^/([0-9]+)/(.*)$ {
set $width $1;
set $path $2;
rewrite ^ /$path break;
proxy_pass http://127.0.0.1:8888/$width/$path;
proxy_cache ${CACHE_NAME};
proxy_cache_valid 200 302 24h;
proxy_cache_valid 404 1m;
# expire time for browser
expires ${EXPIRE_TIME};
}
location ~ ^/([0-9]+)x([0-9]+)/(.*)$ {
set $width $1;
set $height $2;
set $path $3;
rewrite ^ /$path break;
proxy_pass http://127.0.0.1:8888/${width}x${height}/$path;
proxy_cache ${CACHE_NAME};
proxy_cache_valid 200 302 24h;
proxy_cache_valid 404 1m;
# expire time for browser
expires ${EXPIRE_TIME};
}
}