Apache User authentication Configuration

Source: Internet
Author: User

Sometimes, we need to give some special access to set up a user authentication mechanism to increase security! The essence of Apache user authentication is to give users access to add a password authentication process, before introducing the Apache certification to introduce a tool to create a password htpasswd!

#/usr/local/apache2/bin/htpasswd parameter:-C: Create a new password file-D: Delete a user-M: Encrypted with MD5 encoding-D: Crypt encoded encryption, this is the default way -P: Password in plaintext format-s: With SHA encoded encryption

First open the corresponding virtual host configuration file

Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf

Add the following configuration to the corresponding virtual host

<DIrectory/data/www/abc>//Specify the directory to be certified allowoverride authconfig authname "ABCD"//Set up users with authentication , the description will appear in the dialog box of a question displayed to the user's password AuthType basic//encryption method, Basic authentication does not encrypt the address from the user's browser authuserfile/data/.htpasswd//below Password file to create require Valid-user//set Allow access to users </Directory>

Create a user for authentication

#/usr/local/apache2/bin/htpasswd-cm/data/.htpasswd user1

Enter after entering the set password, the first time to create a user to add the-C option, the second time directly created without adding-c! When using HTPASSWD to create a user password, if the current directory is no longer/usr/local/apache2/bin, write/usr/local/apache2/bin/htpasswd, or you can add the path variable, it is not so troublesome, Direct htpasswd is possible!

Be sure to restart the Apache service after setting up the virtual host:

/USR/LOCAL/APACHE2/BIN/APACHECTL-T//Detect configuration file is correct/usr/local/apache2/bin/htpasswd restart//restart Apache service


This article is from the "Custom" blog, so be sure to keep this source http://zidingyi.blog.51cto.com/10735263/1708190

Apache User authentication Configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.