Last active
January 24, 2017 11:40
-
-
Save ucotta/b56932493a3146f074bca20a04265098 to your computer and use it in GitHub Desktop.
Add httpass authentication to nging
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
#!/bin/bash | |
# First step, prepare the .htpasswd file | |
# Add the user | |
sh -c "echo -n 'USERNAME:' >> /etc/nginx/.htpasswd" | |
# Then, add the password | |
sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd" | |
# Now, add it to your location | |
# auth_basic "Restricted Content"; | |
# auth_basic_user_file /etc/nginx/.htpasswd; | |
# And now restart your server | |
service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment