User authentication for Apache

Source: Internet
Author: User

In their own or the company's website, in order to prevent web site files were tampered with, vandalism, etc., often using Apache user authentication to distinguish between the use of permissions to achieve safe operation of the site. As an OPS person, it is necessary to ensure the security of website files.

In the built lamp environment, using Apache user authentication, the specific operation is as follows

For example, in the building of the site, file pictures, etc. placed in the site directory ABC, the directory of ABC for the Apache user authentication,

Change the virtual host profile/usr/local/apache2/conf/extra/httpd-vhosts.conf file, add <Directory> segments in the <virtualhost *:80>, Specifically add the following:

<Directory/data/www/abc>

AllowOverride authconfig

AuthName "!!!!!!!!!!!!"

AuthType Basic

authuserfile/data/.htpasswd

Require Valid-user

</Directory>


where authtype for the user authentication type, AuthName for user authentication when the name of the popup dialog, AuthUserFile authentication when the user name and password file, require Valid-user represents the present. The user name and password in the htpasswd file can be logged in

Create a htpasswd file:/usr/local/apache2/bin/htpasswd-c/data/.htpasswd user1, the statement is created by a User1 user, enter the password. If you want to continue to create the user, then/usr/local/apache2/bin/htpasswd/data/.htpasswd user2, you do not need to add the-c option, otherwise the User1 will be overwritten. Restart Apache service can, at this time Apache authentication is done, in the access to the ABC directory files, it is necessary to use the user name and password login.

This article is from the "10692884" blog, please be sure to keep this source http://10702884.blog.51cto.com/10692884/1716518

User authentication for Apache

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.