Skip to content

Instantly share code, notes, and snippets.

@surjikal
Created June 11, 2012 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surjikal/2911653 to your computer and use it in GitHub Desktop.
Save surjikal/2911653 to your computer and use it in GitHub Desktop.
Nginx Notes

To get htaccess like user authentication on Nginx, add the following to your site config:

auth_basic            "Restricted";
auth_basic_user_file  <password_file_location>;

If you want the authentication to be applied on all locations, place it in the top scope of the config. If you want it specific to a location, just add it in the scope of that location.

Creating a password file

printf "John:$(openssl passwd -crypt <PASSWORD>)\n" 

NOTE: I'm not sure about how secure that thing is.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment