nginx htaccess

.htaccess protection with nginx

Hey just recently had a requirement where in I had to set password for my website. It was a ruby on rails website and I had to set .htaccess for it. I knew how to setup .htaccess for apache but with nginx (that our site was using as webserver) I didnt knew what to do.

Then I figured out the solution

Open nginx.conf file. Search for the location word you might see multiple location configuration. But put the code below in the root location

Syndicate content