proxy_cache_path /var/cache/nginx/cache keys_zone=elasticsearch:10m inactive=60m;
upstream elasticsearch_servers {
zone elasticsearch_servers 64K;
server 192.168.187.132:9200;
server 192.168.187.133:9200;
}
match statusok {
status 200;
header Content-Type ~ “application/json”;
body ~ ‘“status” : 200’;
}
server {
listen 9200;
status_zone elasticsearch;
location / {
proxy_pass http://elasticsearch_servers;
proxy_http_version 1.1;
proxy_set_header Connection “”;
proxy_cache elasticsearch;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
proxy_connect_timeout 5s;
proxy_read_timeout 10s;
health_check interval=5s fails=1 passes=1 uri=/ match=statusok;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
access_log logs/es_access.log combined;
}
server {
listen 8080;
root /usr/share/nginx/html;
location / {
index status.html;
}
location =/status {
status;
}
}