nginx cheat sheet Add authentication to elasticsearch server { listen 80; listen [::]:80; server_name domain.org; auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/htpasswd-domain-org.users; location / { proxy_pass http://127.0.0.1:5601; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; } } Add user for basic authentication echo "username:$(openssl passwd -apr1)" | sudo tee -a /etc/nginx/htpasswd.users