I didn’t wait for an answer, but this function was very much needed. I made such a decision.
mkdir /usr/local/lsws/conf/vhosts/xendev.ru
cd /usr/local/lsws/conf/vhosts/xendev.ru
touch htpasswd htgroup
chown -R lsadm:nogroup /usr/local/lsws/conf/vhosts/xendev.ru
find /usr/local/lsws/conf/vhosts/xendev.ru -type f -exec chmod 750 {} \;
find /usr/local/lsws/conf/vhosts/xendev.ru -type d -exec chmod 750 {} \;
htpasswd -c htpasswd DimmmCom #DimmmCom - this is login, then enter the password twice
#######################
If the htpasswd utility is not installed on the system, then install
sudo apt install apache2-utils
#######################
#######################
Add to the end of the host configuration file
/www/server/panel/vhost/openlitespeed/detail/xendev.ru.conf
#######################
realm ProtectedSite {
userDB {
location $SERVER_ROOT/conf/vhosts/xendev.ru/htpasswd
maxCacheSize 200
cacheTimeout 60
}
groupDB {
location $SERVER_ROOT/conf/vhosts/xendev.ru/htgroup
maxCacheSize 200
cacheTimeout 60
}
}
context / {
allowBrowse 1
realm ProtectedSite
authName Protected Site
rewrite {
}
addDefaultCharset off
phpIniOverride {
}
}
#######################
Restart OLS
#######################
Instead of xendev.ru we register our data.
In the context section, indicate what to set the password for. In this case, the password is set for the entire site.
If, for example, you need to password-protect a specific folder (admin), then the context section will look like this:
context /admin/ {
location admin/
allowBrowse 1
realm ProtectedSite
authName Protected Site
rewrite {
}
addDefaultCharset off
phpIniOverride {
}
}
If, for example, a certain file (drupal.zip) needs to be password protected, then the context section will look like this:
context /drupal.zip {
location ./drupal.zip
allowBrowse 1
realm ProtectedSite
authName Protected Site
rewrite {
}
addDefaultCharset off
phpIniOverride {
}
}
@aaPanel_Jose , @aapanel_power , @aaPanel_Captain , @aapanel_sniper I hope that in future versions of aaPanel this feature will appear in the site settings.