Apache2 authentication configuration-Impact on server of ubuntu again

Source: Internet
Author: User

One day, I suddenly found that the configured HTTP server was used by many unidentified people on the Internet. So I thought about configuring an authentication and the configuration was successful in accordance with [configuration verification] actual Apache user verification. There are three main steps:

1. modify the contents of the Directory section in the httpd. conf file. 

1 <directory "/data/movies/">
2 indexoptions charset = gb2312
3 options indexes followsymlinks
4 AllowOverride authconfig
5 order allow, deny
6 allow from all
7 </directory>

The AllowOverride entry of Row 3 must be set to authconfig to allow. the authentication command in the htaccess document, of course, can be set to all to execute. all configurations in htaccess; none is ignored. htaccess document.

This is not the same as above.

2. Create a. htaccess file under the directory to be authenticated. There are two ways to save authentication information:

1. Users and group files must be stored in text data. The file generation method is described in step 1.

1 authname "Password File auth"
2 authuserfile/opt/apache2/CONF/Password
3 authgroupfile/opt/apache2/CONF/group
4 require group FTP

2. Save it to the database. The generation method is described in step 1.

1 authname "DB auth"
2 authdbuserfile/opt/apache2/CONF/dbuser. dat
3 require username1

 

 

 3. Create a password file to generate authentication information. There are two methods:

I. user and group file Methods,

1. If you generate a user file, you will be prompted to enter the password.

1/opt/apache2/bin/htpasswd-C/opt/apache2/CONF/password username1
2/opt/apache2/bin/htpasswd/opt/apache2/CONF/password username2

 

2. Create a New/opt/apache2/CONF/group file in the group file. The content is as follows:

1 ftp: username1 username2

 

Ii. Database Methods

1/opt/apache2/bin/dbmmanage/opt/apache2/CONF/dbuser. dat adduser username1

 

Now, the basic configuration is complete and can be used. Note that you can set multiple groups in the group file, and then specify different groups in the. htaccess file under the directory that requires different authentication to control different users to access different 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.