Apache Server has built-in user verification mechanism Apache server implements user authentication, and everyone can control some parts of the website to be verified as long as they are set up. As soon as I follow, I should easily implement user verification. Pre-preparatory, you must already install apache, if it is not installed, or if you are very vague, please go to http://www.5ilinux.com/apache01.html Step 1 We are in / var / www (Apache's home page Catalog) Create a test directory mkdir / var / www / test second step, we edit httpd.conf Add Alias / Test "/ var / www / test"
Options Indexes MultiViews
ALOWOVERRIDE Authconfig # indicates authentication
ORDER ALOW, DENY
ALLOW FROM ALL
Directory>
#Allowoverride Authconfig Represents Authentication This is a key setting Step 3 In / var / www / test creation .htaccess file vi /var/www/test/.htaccess
Authname "Frank Share Web"
Authtype Basic
Authiserfile /var/www/test/.htpasswd
Require Valid-User
#Authname description, just write #authuserfile /var/www/test/.htpasswd#Require Valid-user or Require user FRANK limit is all legitimate users or specify the user # 密 密 file recommended to use .htpasswd, because Apache default system pair ".ht "The beginning of the file is not allowed to read the external reading by default, and the safety factor will be a little higher. Step 4 is to create an Apache's verification user htpasswd -c /var/www/test/.htpasswd frank # For the first time, create a user to use the -c parameter to add users, if you want to change your password. You can restart the apache service as follows, restart the Apache service, then access http: // If your website address / test If you go smoothly, you should see a user-validated pop-up window, as long as you fill in the fourth The username and password created in step will be used for the server. For the server's performance, it is generally not recommended to use Allowoverride AUTHCONFIG or AllowOverride ALL, as this will make the server will continue to find .htaccess, which affects the performance of the server, usually we will manage some background management Interface or other special directorys may need to be added to verify this demand.