Last active
September 30, 2016 21:45
-
-
Save GhazanfarMir/d540f99daef38db67b1de3145f8f94c2 to your computer and use it in GitHub Desktop.
NGINX Implement Auth Basic
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; | |
server_name www.example.com | |
root /var/www/html/sites/example.com | |
## implementing Basic Authentication | |
auth_basic "Administrators Only Area" | |
auth_basic_user_file /etc/nginx/.htpasswd | |
} | |
# usage | |
# Create a file and add the user | |
# sudo htpasswd -c /etc/nginx/.htpasswd admin | |
# $new password: ****** | |
# $retype new password: ***** | |
## add another user | |
# sudo htpasswd /etc/nginx/.htpasswd GhazanfarMir | |
# $password: ********* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment