Created
January 29, 2013 09:06
-
-
Save iambibhas/4662891 to your computer and use it in GitHub Desktop.
Basic HTTP Auth for Nginx
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
| username:sayVb7E97UXnw |
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
| $ irb | |
| irb(main):001:0> “mypassword”.crypt(“salt”) | |
| => “sayVb7E97UXnw” |
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
| server { | |
| #server stuff here | |
| location / | |
| auth_basic "Restricted"; | |
| auth_basic_user_file /location/of/htpasswd; | |
| # other location stuff here | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo service nginx reloadafter this.