This is an old revision of the document!


How to set Site Authentication

Authentication is the process of confirming a user's identity, and it provides a way to ensure that legitimate users create content on your site. The first thing we are going to do is create authentication database.

Step 1.Create Authorization Realms DB

We will create a new one as example

Choose DB type as Password File

Set:

  1. Realm name, e.g. TEST
  2. DB Location, e.g. $VH_ROOT/conf/TESTDB

Step 2.Create Auth user

Set e.g. User/Password TEST/TEST

Step 3. Add Access Require by Context

Add a Context and select type as Static

Set:

  1. URI /
  2. Set Location $VH_ROOT/html/
  3. Accessible Yes
  4. Realm TEST
  5. Access Allowed *

Step1. 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

Step 2. Add Access Require by htaccess

Add following rules into your .htaccess file.

AuthType Basic
AuthName "My Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
  1. AuthName can be set to any, e.g. TEST
  2. AuthUserFile need a valid file, e.g./usr/local/lsws/DEFAULT/conf/TESTDB

Access the site will require auth login

  • Admin
  • Last modified: 2018/06/15 20:56
  • by Eric Leu