-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf.mako
62 lines (49 loc) · 1.41 KB
/
nginx.conf.mako
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
worker_processes 1;
daemon off;
error_log stderr notice;
events {
worker_connections 1024;
}
http {
upstream elasticsearch {
# elastic search server
<%! import os %>
server ${os.environ['ELASTICSEARCH_PORT_9200_TCP_ADDR']}:${os.environ['ELASTICSEARCH_PORT_9200_TCP_PORT']} max_fails=3 fail_timeout=30s;
}
upstream backend {
server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
}
server {
listen 8080;
location /ok/ {
return 200;
}
}
server {
listen 80 default_server;
location / {
# It is necessary option
keepalive_timeout 0;
lua_need_request_body on;
proxy_ignore_client_abort on;
# set it 'on' if you want to log POST body
set $send_body off;
set $target_url /target;
content_by_lua_file /usr/share/nginx/stat_sender.lua;
}
location /target {
internal;
rewrite ^/target/(.*)$ /\$1 break;
# pass request to location/upstream/fastcgi/etc
proxy_pass http://backend/;
}
location ~ /elasticsearch {
internal;
rewrite ^/elasticsearch/(.*)$ /$1 break;
proxy_connect_timeout 5s;
proxy_send_timeout 5s;
proxy_read_timeout 5s;
proxy_pass http://elasticsearch;
}
}
}