Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Nginx and Password Protecting Directories
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Nginx and Password Protecting Directories

xaitmixaitmi Member

Hi. I placed this file inside the folder I want password protected as .htaccess

# nginx configuration
auth_basic "Restricted Area";
auth_basic_user_file /home/nginx/domains/mydomain.com/private/.htpasswd;

But when I go to that page it does not request me to enter the details stored in .htpasswd.

I even tried restarting nginx.

Anyone know what I am doing wrong?

Comments

  • Have you set up Nginx in such a way that it will load .htaccess files like that?

    .htaccess is an Apache concept, so unless you have configured Nginx to, it's not going to read any .htaccess files.

    Thanked by 1xaitmi
  • xaitmixaitmi Member
    edited April 2015

    @Detruire said:
    Have you set up Nginx in such a way that it will load .htaccess files like that?

    .htaccess is an Apache concept, so unless you have configured Nginx to, it's not going to read any .htaccess files.

    Nope. All I've done so far is install CentMinMod http://centminmod.com/

    I didn't know .htaccess was an only apache thing.

    Time to set this up http://kbeezie.com/protecting-folders-with-nginx/

  • Got it all working now.

    Thanks @Detruire

Sign In or Register to comment.