Created
September 20, 2013 16:00
-
-
Save karmi/6639791 to your computer and use it in GitHub Desktop.
Create a local Nginx-based proxy for <http://download.elasticsearch.org> for demos at conferences, meetups, etc
This file contains hidden or 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
# Create a local proxy for <http://download.elasticsearch.org> | |
# ============================================================ | |
# | |
# This setup and Nginx configuration provides a local webserver which intercepts requests | |
# to <http://download.elasticsearch.org> and serves a local file instead, | |
# facilitating and speeding up demonstrations at conferences, meetups, etc. | |
# | |
# | |
# 1. Create directories for Nginx: | |
# | |
# $ mkdir -pv tmp/logs tmp/html | |
# | |
# 2. Download the Elasticsearch archive from the internet | |
# | |
# $ curl -# -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz | |
# | |
# 3. Add intercepting into `/etc/hosts` | |
# | |
# $ grep download.elasticsearch /etc/hosts || \ | |
# sudo sh -c 'echo "127.0.0.1 download.elasticsearch.org\n::1 download.elasticsearch.org" >> /etc/hosts' | |
# | |
# 4. Launch Nginx | |
# | |
# $ sudo nginx -p "$PWD/tmp/" -c "$PWD/download.elasticsearch.conf" | |
# | |
# Use the <http://download.elasticsearch.org> URL in your scripts: | |
# | |
# $ curl -I http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz | |
# | |
# | |
# Stop Nginx with: | |
# | |
# $ sudo nginx -p "$PWD/tmp/" -c ../download.elasticsearch.conf -s quit | |
# | |
events {} | |
http { | |
server { | |
listen 80; | |
server_name elasticsearch.org; | |
rewrite_log on; | |
location ~ .*tar.gz { | |
rewrite ^/.*/.*/(.*)$ /$1 break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment