Last active
August 29, 2015 14:17
-
-
Save TheLastCicada/090e51fb4f58da5113da to your computer and use it in GitHub Desktop.
Nginx ES config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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