Comments on Basic HTTP Authentication with Nginx

This tutorial shows how you can use basic HTTP authentication with Nginx to password-protect directories on your server or even a whole website. This is the Nginx equivalent to basic HTTP authentication on Apache with .htaccess/.htpasswd.

6 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: TiTex

What if i only want to grant access to one user of the two ?

Like apaches's 'require user username'

By: Andrew

using nginx and htpasswd, i get the authorization dialogue, and it correctly accepts the login, and resets the dialogue when entering false details, but if I press cancel, it shows the index.html page anyway!?

By: ianx

i try on wordpress its not working. 

work for auth but for login its not php file downlaoded

By: Ben

I get this in Ubuntu 16.* when I run a htpasswd.py command:

Traceback (most recent call last):  File "/usr/local/bin/htpasswd.py", line 20, in <module>    from trac.util import saltImportError: No module named trac.util

By: Patrick

Thanks, this was helpful and worked like a charm!

By: Manuel

Hey guys if I want password protect folders and subfolders and not the files inside the folders, for example, .jpg and .pngs how can this be accomplished?