Apache user authentication
After setting up the LAMP environment and installing Discuz, how to use the user authentication function of Apache, this function will create a page only, which can only be accessed after entering the password! The command operates as follows:
Cd / data/www
Mkdir abc
Cd abc
Cp / etc/passwd. / 12.txt
Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf (insert the following information before the last line)
Allowoverride AuthConfig
AuthName "Custom"
AuthType Basic
AuthUserFile / data/.htpasswd
Require valid-user
# "Custom" is the password prompt for the pop-up window of a web page
Save exit
Vim / etc/profile.d/path.sh (add the following information at the end)
: / usr/local/apache2/bin/
Save and put forward
Source / etc/profile.d/path.sh
Htpasswd-c / data/.htpasswd user1 (- c stands for creation, and again, use this command to create users without adding-caches! It will be covered! )
Cat / dat/.htpasswd
Htpasswd / data/.htpasswd user2
Cat / dat/.htpasswd
Apachectl-t
Apachectl graceful
Browse www.test.com/abc/12.txt
Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf