Skip to content

Instantly share code, notes, and snippets.

@TheLastCicada
Last active August 29, 2015 14:17
Show Gist options
  • Save TheLastCicada/090e51fb4f58da5113da to your computer and use it in GitHub Desktop.
Save TheLastCicada/090e51fb4f58da5113da to your computer and use it in GitHub Desktop.
Nginx ES config
server {
listen 80 default;
server_name search.yourdomain.com;
# Elasticsearch private endpoint
location /private {
# IP of the webserver you want to be able to do everything
allow 24.84.205.111;
deny all;
# Strip the /private from the request and proxy it to ES
rewrite ^/private(.*) $1 break;
proxy_pass http://127.0.0.1:9200;
}
# public endpoint where JS can connect for auto-suggest
location /public {
# Put restrictions on what can be done
location ~* (.*)_suggest$ {
limit_except POST {
deny all;
}
rewrite ^/public(.*) $1 break;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:9200;
}
return 403;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment