Apache Settings Access Certification

xiaoxiao2021-03-06  16

Apache certification

Sometimes the files in some directory need to increase authentication, and Apache default authentication modules are very complete. Here is an example of increasing user authentication through .htaccess files. Even for virtual host users, authentication control can be implemented by uploading some files.

ServerAdmin webmaster@xxx.com.cn DocumentRoot / data / mrtgwww / ServerName mrtg.xxc.com.cn # ErrorLog logs / dummy-host.example.com-error_log # CustomLog logs / dummy-host.example .com-access_log commit options INDEXES FOLLOWSYMLINKS ALOWOVERRIDE Authconfig ORDER ALLOW, DENY Allow from All

First create a password file with htpasswd: such as file name called my.passwd / home / apache / bin / htpasswd -c -b my.passwd myusername mypassword If adding account: / home / apache / bin / htpasswd -b my.passwd anotherusername ANOTHERPASSWORD

Upload my.passwd to a non-published path. For example, your physical web root directory last level /Home/apache/conf/my.passwd

Create .htaccessautauthname "My Authorization Directory" Authty Basicauthuserfile /Home/apache/conf/my.passwdrequire Valid-User

Upload this file to you need user-certified directory: /Home/apache/htdocs/admin/.htaccess

Such an access to this directory needs to be certified.

-c creation password file

[root @ hotrm-nj1 bin] # ./htpasswd --helpusage: htpasswd [-cmdpsd] passwordfile username htpasswd -b [cmdpsd] passwordfile username password

htpasswd -n [mdps] username htpasswd -nb [mdps] username password -c Create a new file -n Do not update file;. display results on stdout -m Force MD5 encryption of the password -d Force CRYPT encryption of.. the password (default). -p Do not encrypt the password (plaintext). -s Force SHA encryption of the password. -b Use the password from the command line rather than prompting for it. -D Delete the specified user.

转载请注明原文地址:https://www.9cbs.com/read-41218.html

New Post(0)