Skip to content

Instantly share code, notes, and snippets.

@innovia
Created November 21, 2017 18:38
Show Gist options
  • Save innovia/3584fc46fcf235dc3cbb02db16c4bf01 to your computer and use it in GitHub Desktop.
Save innovia/3584fc46fcf235dc3cbb02db16c4bf01 to your computer and use it in GitHub Desktop.
# nginx proxy for Elasticsearch + Kibana
server {
listen 127.0.0.1:8080;
server_name your.domain.com;
# AWS DNS resolver (if you're running on AWS EC2, else use google DNS 8.8.8.8)
resolver 172.31.0.2;
# Fix nginx resolving url only on config load (AWS can change the endpoint IP at anytime)
# by using a variable, it forces nginx to resolve the resolver above.
set $proxy_pass_url https://<aws-es-url-here>.es.amazonaws.com;
location / {
proxy_set_header Host $proxy_pass_url;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
proxy_set_header Authorization "";
proxy_pass $proxy_pass_url/_plugin/kibana/;
proxy_redirect $proxy_pass_url/_plugin/kibana/ https://your.domain.com/kibana/;
}
location ~ (/app/kibana|/app/timelion|/bundles|/es_admin|/plugins|/api|/ui|/elasticsearch) {
proxy_pass $proxy_pass_url;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Authorization "";
proxy_hide_header Authorization;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment