Protected directory VHost Template

#1
Hi, new in openlitespeed ...

I created a virtual host with a Vhost Template, now I want to protect a directory with a password, I follow this guide, https://openlitespeed.org/kb/user-authentication-Through-realms/ but when I save the URLs of htpasswd and htgroup, litespeededed doesn't ask me to create files ... (I think because it's a vhost)

I can't even create them from the terminal with "sudo htpasswd -c ..."

How do I create them? How do I protect a directory with a password if the virtual host was created by Vhost Template?
 

Cold-Egg

Administrator
#2
Because it's a template virtual host, web server doesn't know which virtual host you want to create and where to create, so you need to create the file manually.

In my test, I'd put $SERVER_ROOT/conf/vhosts/$VH_NAME/.htpass to the User DB Location.
Then you can go to the SSH console and create the file manually.
Code:
mkdir -p /usr/local/lsws/conf/vhosts/example.com/.htpass
Add the user/pass manually
Code:
htpasswd -c .htpass user
Then change the folder permission.
Code:
chown -R lsadm:nobody /usr/local/lsws/conf/vhosts/example.com/
Please substitute the file name, user/pass, and webserver owner you want.
 
#4
I tried
sudo touch /usr/local/lsws/conf/vhosts/example.com/.htpasswd
sudo htpasswd -c /usr/local/lsws/conf/vhosts/example.com/.htpasswd username
sudo chown -R lsadm:lsadm /usr/local/lsws/conf/vhosts/example.com

I think it work...
 
Top