Skip to content

Instantly share code, notes, and snippets.

@Mao8a
Last active August 29, 2015 14:25
Show Gist options
  • Save Mao8a/8a8b61d84aa0c2627dca to your computer and use it in GitHub Desktop.
Save Mao8a/8a8b61d84aa0c2627dca to your computer and use it in GitHub Desktop.
NGINX: HTTP Authentication HTTP Authentication

HTTP Authentication

Instal apache utils and create.htpasswd file:

sudo apt-get install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd [exampleuser]

Add this two lines inside location /

auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;

Reload nginx nginx -s reload or service nginx restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment