Skip to content

Instantly share code, notes, and snippets.

@artbikes
Created March 21, 2012 21:27
Show Gist options
  • Save artbikes/2152996 to your computer and use it in GitHub Desktop.
Save artbikes/2152996 to your computer and use it in GitHub Desktop.
nginx proxy for elasticsearch
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default;
location / {
rewrite ^(.*) https://$host$1 permanent;
}
}
server {
listen 443 default;
ssl on;
ssl_certificate /etc/ssl/private/webscale.pem;
ssl_certificate_key /etc/ssl/private/webscale.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:MEDIUM:!ADH;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
location / {
auth_basic "Restricted";
auth_basic_user_file .htpasswd;
proxy_pass http://0.0.0.0:9200/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Protocol https;
proxy_set_header Host $http_host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment