Apache user authentication

Source: Internet
Author: User

Sometimes we need some special access to set up a user authentication mechanism, add security, such as a directory of our site, we just want to give specific people to view, other people do not see. We can encrypt authentication for this directory.

--------------------------------------------------------------------------------------------------------

# vi/usr/local/apache2/conf/extra/httpd-vhosts.conf

Add the following red Font section to the corresponding virtual host configuration

<virtualhost *:80>

DocumentRoot "/data/www"

ServerName www.test.com

<Directory/data/www/abc/>

AllowOverride authconfig

AuthName "Custom"

AuthType Basic

authuserfile/data/.htpasswd

Require Valid-user

</Directory>

</VirtualHost>

--------------------------------------------------------------------------------------------------------

#/USR/LOCAL/APACHE2/BIN/HTPASSWD-CM/DATA/.HTPASSWD Test Create authenticated user

New Password: Set password

Re-type New password: Confirm password

Adding Password for user Liuqi Add authentication User Success

--------------------------------------------------------------------------------------------------------

Then restart the Apache service

#/usr/local/apache2/bin/apachectl-t

Syntax OK

Check that the configuration is correct first

/usr/local/apache2/bin/apachectl Graceful

--------------------------------------------------------------------------------------------------------


All OK, self test!

This article from "Youth A Little Flood" blog, declined reprint!

Apache user authentication

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.