Open usr/local/apache2/conf/extra/http-vhostd.conf
1. Vim usr/local/apache2/conf/extra/http-vhostd.conf Enter these
<Directory/data/www/admin.php>
AllowOverride authconfig
AuthName "Welcome" Custom
AuthType Basic
authuserfile/data/.htpasswd Password file
Require Valid-user
</Directory>
2./usr/local/apache2/bin/hdpasswd-c/data/.hdpasswd Text
Enter password
Re-enter
3. When you create a user doc,
/USR/LOCAL/APACHE2/BIN/HDPASSWD/DATA/.HDPASSWD doc
The-c option is not required.
4./usr/local/apache2/bin/apachectl-t
5./usr/local/apache2/bin/apachectl Graceful
6. In the browser input www.123.com/admin.php (why here is 123.com, you can view the file usr/local/apache2/conf/extra/http-vhostd.conf servername Www.123.com, if it is something else, just enter something in the browser)
This article from the "Linux Learning Space" blog, reproduced please contact the author!
Apache user authentication