Apache user authentication

Source: Internet
Author: User

1. Configure user authentication for a virtual host

Requirement: User access to 123.txt files in/DATA/WWW/ABC directory requires authentication

[Email protected] www]# mkdir ABC

[[Email protected] www]# CD ABC

[Email protected] abc]# cp/etc/passwd 123.txt

[Email protected] abc]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf

In the corresponding virtual host configuration file segment, add the following code (Chinese note, do not add, otherwise will be error)

<directory/data/www/abc> 
  allowoverride authconfig
  AuthName "Custom"
  authtype basic
  require VALID-USER
</directory

650) this.width=650; "title=" 1.png "alt=" wkiom1xi8ruzia-waahmrqnwbx4559.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/68/wkiom1xi8ruzia-waahmrqnwbx4559.jpg "width=" 650 "style=" Padding:0px;margin:0px;vertical-align:top;border: none; "/>

After saving, then create an Apache authenticated user

[Email protected] abc]#/usr/local/apache2/bin/htpasswd-c/data/.htpasswd TPP

The first time to create a user TPP to use the-c parameter, the 2nd time to add the user, do not use the-c parameter, because-C is the meaning of the creation, if added will put this file rewrite.

New Password:

Re-type New Password:

Adding Password for user TPP

[Email protected] abc]#/usr/local/apache2/bin/apachectl-t

Syntax OK

[Email protected] abc]#/usr/local/apache2/bin/apachectl restart

Then we'll visit the next

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/8F/wKiom1ciMK_yRuIzAACzKs38KbY360.png "title=" 1111. PNG "alt=" Wkiom1cimk_yruizaaczks38kby360.png "/>

The above is garbled, is a character set problem, because the configuration file written "Custom", we can write in English.




This article is from "Linux rookie" blog, please be sure to keep this source http://490617581.blog.51cto.com/11186315/1768849

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.