Created
May 18, 2017 18:59
-
-
Save blikenoother/cf0299cb033f9182e030f472e159efc0 to your computer and use it in GitHub Desktop.
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
# package for generating .htpasswd file | |
sudo apt-get install apache2-utils | |
# create .htpasswd file | |
sudo htpasswd -c /etc/nginx/.htpasswd username (this will prompt you for password) | |
# add following 2 line in nginx config (/etc/nginx/sites-available/test.com) | |
auth_basic "Restricted"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
# sample config file | |
server { | |
server_name test.com www.test.com; | |
root /opt/test; | |
index index.html; | |
auth_basic "Restricted"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment