-
Notifications
You must be signed in to change notification settings - Fork 8
/
nginx-static.conf
127 lines (97 loc) · 2.87 KB
/
nginx-static.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
worker_processes 4;
daemon off;
pid /var/run/nginx.pid;
error_log stdout info;
events {
worker_connections 1024;
}
error_log stderr info;
env IMAGING_ALLOWED_ORIGINS;
env IMAGING_MAX_WIDTH;
env IMAGING_MAX_HEIGHT;
env IMAGING_DEFAULT_QUALITY;
env IMAGING_DEFAULT_STRIP;
env IMAGING_MAX_OPERATIONS;
env IMAGING_DEFAULT_FORMAT;
env IMAGING_MAX_CONCURRENCY;
env IMAGING_NAMED_OPERATIONS_FILE;
http {
include 'resolvers.conf';
merge_slashes off;
lua_shared_dict imaging 1m;
init_worker_by_lua_block {
local imaging = require "resty.imaging"
imaging.init{
shm_name = "imaging"
}
}
proxy_cache_path /tmp/imaging-frontend-cache
levels=1:2
keys_zone=imaging-frontend-cache:10m
max_size=2g
inactive=60m
use_temp_path=off;
proxy_next_upstream_tries 2;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
upstream imaging {
keepalive 32;
server 127.0.0.1:8081;
}
server {
listen 8080;
server_name default_server;
proxy_cache imaging-frontend-cache;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_lock on;
proxy_buffers 16 128k;
proxy_busy_buffers_size 256k;
add_header X-Imaging-Status $upstream_cache_status;
more_set_headers "cache-control: public, max-age=300, s-maxage=86400"
proxy_cache_valid 200 1h;
location /status {
access_by_lua_block {
local imaging = require "resty.imaging"
imaging.status_page()
}
}
location / {
proxy_pass http://imaging;
proxy_http_version 1.1;
proxy_set_header Connection "";
log_by_lua_block {
local imaging = require "resty.imaging"
imaging.log_phase()
}
}
}
server {
listen 8081;
server_name default_server;
lua_ssl_trusted_certificate '/etc/ssl/certs/ca-certificates.crt';
lua_ssl_verify_depth 10;
keepalive_timeout 120s;
keepalive_requests 100;
location ~ ^(?<imaging_base_url>.*)$ {
set $imaging_params "$args";
set $imaging_url "http://127.0.0.1:8082$imaging_base_url$is_args$args";
add_header Cache-Tag $imaging_base_url;
access_by_lua_block {
local imaging = require "resty.imaging"
imaging.access_phase()
}
content_by_lua_block {
local imaging = require "resty.imaging"
imaging.request_handler()
}
}
}
server {
listen 8082;
server_name default_server;
keepalive_timeout 120s;
keepalive_requests 100;
location / {
root /images;
}
}
}