First, basic certification:
(1) Define a security domain
<directory "" >
Options None
AllowOverride None
AuthType Basic
AuthName "STRING"
AuthUserFile "/path/to/httpd_user_passwd_file"
Require User username1 UserName2 ...
</Directory>
Allow all users in the account file to log in to access:
Require Valid-user
(2) Provide account and password storage (text file)
Manage with the HTPASSWD command
htpasswd [Options] passwordfile username
-C: Automatically create passwordfile, so it should only be used when the first user is added;
-M:MD5 Encrypt user password;
-S:SHA1 Encrypt user password;
-D: Delete the specified user
(3) Implementation of group-based authentication
<directory "" >
Options None
AllowOverride None
AuthType Basic
AuthName "STRING"
AuthUserFile "/path/to/httpd_user_passwd_file"
AuthGroupFile "/path/to/httpd_group_file"
Require Group GROUP1 GROUP2 ...
</Directory>
To provide: User account files and group files;
Group files: Define a group for each row
Grp_name:user1 user2 User3 ...
Second, each virtual host has a dedicated configuration:
You can disable a central host: Comment DocumentRoot
<virtualhost "Ip:port" >
Severname
DocumentRoot ""
</VirtualHost>
Serveralias: Alias of the virtual host;
Errorlog
Customlog
<directory "" >
......
</Directory>
httpd2.2 (CENTOS6) Configuration Authentication landing page, document-based authentication (basic)