Lock Folder not Lock Site

Hi guys,

Maybe a stupid question but i have a simple PHP site and want to lock www.site.se/admin

Is this possible or can i just Lock the whole site/app?

Have a nice day

Hi @peterc,

We only have the option to lock a site at the moment. The ability to lock a directory we have in our backlog and is something we plan to implement. :slight_smile:

1 Like

Sounds great, thank you

Until Cleavr supports it out-of-the-box, this is how you can go about doing this right now. You can do everything manually yourself but I’m using Cleavr’s built-in “Lock Site” feature to have it create all the required files with minimal manual work.

  1. In Cleavr, select your site, go to Authentication, and click Lock Site to lock it.
  2. From Action dropdown, Add New Credentials.
  3. This is very important: From Action dropdown, select “Unlock Site” to unlock it. DO NOT delete the credentials from step 2.
  4. Go to Site Nginx Config and add the following directive:
location /admin {
   auth_basic "Credentials Required";
   auth_basic_user_file /etc/nginx/cleavr-conf/<YOUR DOMAIN NAME HERE>/.htpasswd;
}
  1. Click Update button and your /admin should now be locked.

If the above steps are confusing, here’s a recording of me doing it successfully. I hope that was helpful.

2 Likes

@ashokgelal ,thank you,

I will try this :slight_smile:

Cleavr now supports locking the whole site or some selective paths. Let us know how well this new feature serves your purpose.

3 Likes