Password protecting folders with nginx

Ever wondered how you can password protect a folder and the underlying content with nginx the same way Apache does? Pretty simple.

First create a htpass-file like so:

Edit your site’s configuration file by adding the following lines of code inside the server-block:

And your folder should be password protected. :)

One thought on “Password protecting folders with nginx

Leave a Reply

Your email address will not be published. Required fields are marked *