forked from cep21/healthcheck_nginx_upstreams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_ngx_config.conf
62 lines (55 loc) · 1.26 KB
/
sample_ngx_config.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
worker_processes 5;
#daemon off;
events {
worker_connections 1000;
}
# Only if you want to see lots of spam
error_log log/error_log debug_http;
http {
upstream test_upstreams {
server localhost:11114;
server localhost:11115;
hash $filename;
hash_again 10;
healthcheck_enabled;
healthcheck_delay 1000;
healthcheck_timeout 1000;
healthcheck_failcount 1;
# Important: There is no \n at the end of this. Or \r. Make sure you
# don't have a \n or \r or anything else at the end of your healthcheck
# response
healthcheck_expected 'I_AM_ALIVE';
# Important: HTTP/1.0
healthcheck_send "GET /health HTTP/1.0" 'Host: www.mysite.com';
# Optional supervisord module support
#supervisord none;
#supervisord_inherit_backend_status;
}
server {
listen 11114;
location / {
root html_11114;
}
}
server {
listen 11115;
location / {
root html_11115;
}
}
server {
listen 81;
location / {
set $filename $request_uri;
if ($request_uri ~* ".*/(.*)") {
set $filename $1;
}
proxy_set_header Host $http_host;
proxy_pass http://test_upstreams;
proxy_connect_timeout 3;
}
location /stat {
healthcheck_status;
}
}
}