This is an old revision of the document!
How to set Access site Authentication
Create Access Password
Method 1. Create account through Realm
Step 1.Create Authorization Realms DB
We will create a new one as example
Choose DB type as Password File
Set:
- Realm name, e.g. TEST
- DB Location, e.g. $VH_ROOT/conf/TESTDB
Step 2.Create Auth user
Method 2. Create account through htpasswd
Run the following command to generate TESTDB file from console
htpasswd -c /PATH_YOU_WANT/TESTDB TEST
Then enter password (e.g.TEST) two times
Protect site by adding auth require
Method 1. Through Context
Add a Context and select type as Static
Set:
- URI
/
- Set Location
$VH_ROOT/html/
- Accessible
Yes
- Realm
TEST
- Access Allowed
*
Method 2. Through .htaccess
Add following rules into your .htaccess file.
AuthType Basic AuthName "My Protected Area" AuthUserFile /path/to/.htpasswd Require valid-user
- AuthName can be set to any, e.g.
TEST
- AuthUserFile need a valid file, e.g.
/usr/local/lsws/DEFAULT/conf/TESTDB