Skip to content

Instantly share code, notes, and snippets.

@thelebster
Created December 25, 2020 11:51
Show Gist options
  • Select an option

  • Save thelebster/06a76abd07cdd430cebecf0e6644c5fe to your computer and use it in GitHub Desktop.

Select an option

Save thelebster/06a76abd07cdd430cebecf0e6644c5fe to your computer and use it in GitHub Desktop.
Nginx reverse proxy for accessing AWS ElasticSearch Kibana
server {
listen 443 ssl;
server_name kibana.domain.com;
rewrite ^/$ https://$host/_plugin/kibana redirect;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
set $kibana_host vpc-kibana-xxxxxxxxxxxxxxxxxxxxxxx.us-east-1.es.amazonaws.com;
location /_plugin/kibana {
# The DNS resolver is located at your primary CIDR block's base IP plus two, check your VPC
resolver 10.1.0.2 ipv6=off;
# Forward requests to Kibana
proxy_pass https://$kibana_host;
# Update cookie domain and path
proxy_cookie_domain $kibana_host $host;
# Response buffer settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# Remove the Authorization header because of basic auth
proxy_set_header Authorization "";
proxy_hide_header Authorization;
# Check https://aws.amazon.com/premiumsupport/knowledge-center/kibana-outside-vpc-nginx-elasticsearch/ for reference
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment