System Security-user authentication on Apache server

Source: Internet
Author: User
The Apache server has a built-in user authentication mechanism. if you set it appropriately, you can control some parts of the website for user verification. As long as you step by step, you can easily implement user verification.

The Apache server has a built-in user authentication mechanism. if you set it appropriately, you can control some parts of the website for user verification. As long as you step by step, you can easily implement user verification.

You must have installed Apache.

Step 2:

Create a test directory under/var/www (apache homepage root directory,


mkdir /var/www/test

Step 2:

Then we compile httpd. conf and add,


Alias/test'/var/www/test'
 
  
Options Indexes MultiViewsAllowOverride AuthConfig # identity verification Order allow, denyAllow from all
 

AllowOverride AuthConfig performs identity authentication, which is a critical setting.

Step 2:


Created in/var/www/test. htaccess file vi/var/www/test /. htaccessAuthName 'Frank share web' AuthType Basic AuthUserFile/var/www/test /. htpasswdrequire valid-user # AuthName description, write # AuthUserFile/var/www/test/at will /. htpasswd # require valid-user or require user frank

We recommend that you use. htpasswd for password files. because apache does not allow external reading of files starting with ". ht" by default, the security factor will be higher.

Step 2:

Is the authentication user who created apache.


htpasswd -c /var/www/test/.thpasswd frank

The first time you create a user, you need to use the-c parameter to add the user 2nd times without the-c parameter. If you want to modify the password, you can:


htpasswd -m .htpasswd frank

Step 2:

Restart the Apache service and visit http: // your website address/test. if the problem persists, a pop-up window for user verification should be displayed, enter the username and password created in step 1.

Later, we do not recommend applying AllowOverride AuthConfig or AllowOverride ALL for the sake of server performance, because this will keep the server searching. htaccess, which affects the efficiency of the server. generally, we need to verify this requirement for some background governance interfaces or other special directories.

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.