What you would normally do in apache with an .htaccess file, nginx requires a different approach.
In sites-enabled, edit your site’s config file by adding the following inside the server block
location = /secret-folder {
auth_basic "Restricted";
auth_basic_user_file /usr/nginx/htpasswd;
}
Make sure you create a htpasswd file in the correct location.
htpasswd -b htpasswd NewUser NewPassword
Very useful nginx wiki.
Good Luck!
Don’t even ask me why I even attempt to use myspace. While trying to login via their horrifyingly ugly home page I was greeted by the following error message upon typing the incorrect password.

Need I say more?
Since I can never seem to be able to find a bookmarked site when I need it. I have decided to post am entry here every time I find something extremely useful.
Today while listening to the Rails Envy podcast I was amazed at how many useful links I those guys were talking about.
One of the most interesting ones was the Rails security cheatsheet.