For example: We have some sensitive data on our website that can't be seen, and we can see that we have to encrypt the data.
[[email protected] www]# mkdir ABC Create a Directory
[[Email protected] www]# CD ABC
[[email protected] abc]# cp/etc/passwd./12.txt copy files to do a test
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/59/wKioL1bmk4LR58dFAABXwvqu_zQ260.png "style=" float: Left; "title=" 1 "alt=" Wkiol1bmk4lr58dfaabxwvqu_zq260.png "/>
Encryption authentication for users
[[email protected] abc]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf Add custom to the main configuration file
<virtualhost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
Serveralias www.aaa.com
# errorlog "Logs/dummy-host.example.com-error_log"
# customlog "Logs/dummy-host.example.com-access_log" common
<Directory/data/www/abc/>
AllowOverride authconfig
AuthName "Custom"
AuthType Basic
authuserfile/data/.htpasswd
Require Valid-user
</Directory>
Set encryption
[Email protected] abc]#/usr/local/apache2//bin/htpasswd-c/data/.htpasswd user1
New Password:
Re-type New Password:
Adding Password for user user1
If you still need to continue creating, remove-C
Check that the configuration file is correct
[Email protected] abc]#/usr/local/apache2/bin/apachectl-t
Syntax OK
Reload
[Email protected] abc]#/usr/local/apache2/bin/apachectl Graceful
Effects after the entry into force
650) this.width=650; "Src=" Https://app.yinxiang.com/shard/s53/res/d10e1c6c-41ae-4d1b-8724-fb330423dc48.png? search=apache%e7%94%a8%e6%88%b7%e8%ae%a4%e8%af%81 "alt=" Apache user Authentication "name=" d10e1c6c-41ae-4d1b-8724-fb330423dc48 " class= "En-media" style= "Margin:.857412em 0px 1.286em;padding:0px;border:0px;height:auto;"/>
This article is from "Mr Guo" blog, declined reprint!
Apache user authentication