Last active
November 30, 2017 16:28
-
-
Save Eli-Goldberg/a1e3d94044c434686fd829ea4c2c3f53 to your computer and use it in GitHub Desktop.
Nginx Proxy - Elastic Search
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
# Be sure to replace the three <> parts | |
# New ubuntu machines annoying locale warnings | |
#sudo locale-gen en_US en_US.UTF-8 | |
#sudo dpkg-reconfigure locales | |
sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y | |
sudo apt-get install nginx -y | |
sudo systemctl status nginx | |
sudo systemctl start nginx | |
sudo nano /etc/nginx/sites-available/default | |
server { | |
listen 80; | |
server_name <your-route-53-pointing-to-this-machine's-external-ip>; | |
location / { | |
proxy_pass <http://your-protected-elasticsearch-address>/; | |
proxy_http_version 1.1; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Authorization ""; | |
proxy_hide_header Authorization; | |
auth_basic "Username and Password are required"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
} | |
} | |
sudo htpasswd -c /etc/nginx/.htpasswd <your_username> | |
cat /etc/nginx/.htpasswd | |
sudo nginx -t | |
sudo service nginx reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment