Configure authenticated users in apache and authenticated users in apache

Source: Internet
Author: User

Configure authenticated users in apache and authenticated users in apache

Sometimes we need to add user authentication to the directories created under my apache server, so that users can easily browse files. The configuration is as follows:

1. Set users
1
Htpasswd-c file_path user_name

Press enter and enter the password. Make sure that the file _ path in the command has the permission to read other users.

2. Set Apache

Add the following content to/etc/apache2/apache2.conf or/etc/httpd/conf/httpd. conf:

1
2
3
4
5
6
7
8
<Directory/var/www/html/picture>
AuthName "Important Directory" # Content prompted during logon
AuthType Basic # authentication method
IndexOptions Charset = GB2312 # webpage Encoding
Options Indexes FollowSymLinks MultiViews # display in directory format
AuthUserFile/opt/. apache_user # User File, file_path in 1
Require valid-user
</Directory>


To hide the server ID, add the following information to the configuration file:

1
2
ServerSignature Off
ServerTokens Prod

For more articles, goXiaopengxuan.

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.