Apache user authentication, domain jump, Apache access log

Source: Internet
Author: User
Tags apache access log

Apache user authentication

1. Edit the file

[Email protected] ~]# vi/usr/local/apache2.4/conf/extra/httpd-vhosts.conf

#打开网页时, let you enter the Apache authenticated username, password

<virtualhost *:80>

DocumentRoot "/data/wwwroot/111.com"

ServerName 111.com

Serveralias www.111.com www.example.com

<Directory/data/wwwroot/111.com>

#指定认证的目录

AllowOverride authconfig

#该行相当于打开用户认证的开关

AuthName "111.com User auth"

#自定义认证的名字

AuthType Basic

#认证类型, generally basic

authuserfile/data/.htpasswd

#指定密码文件所在位置 (need to be added manually)

Require Valid-user

#设定需要认证的用户为 all available users defined in "AuthUserFile"

</Directory>

Errorlog "Logs/111.com-error_log"

Customlog "Logs/111.com-access_log" common

</VirtualHost>


2, create the authentication user name (Shenjie), password (self-input)

HTPASSWD The first time you create input-C

The second time, just type-m

[Email protected] ~]#/usr/local/apache2.4/bin/htpasswd-c-m/data/.htpasswd Shenjie

New Password:

Re-type New Password:

Adding Password for user Shenjie


3, [[email protected] ~]#/usr/local/apache2.4/bin/apachectl Graceful

4. Change the hosts under window

192.168.3.74 www.111.com

5. Visit

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/09/52c5bb48b8254e4ad1f49f07078b6bb3.png-wh_500x0-wm_3 -wmp_4-s_2073748045.png "title=" 6.png "alt=" 52c5bb48b8254e4ad1f49f07078b6bb3.png-wh_ "/>

6, enter the authentication user password error

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/09/cca63a22c6c8db03aed8789fb75f3f33.png-wh_500x0-wm_3 -wmp_4-s_547744052.png "title=" error message. png "alt=" Cca63a22c6c8db03aed8789fb75f3f33.png-wh_ "/>

7. Check the error log

Prompt for permission issues

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/09/f0c725fcba46f8b4b8e020a351978196.png-wh_500x0-wm_3 -wmp_4-s_1474805862.png "title=" permission. png "alt=" F0c725fcba46f8b4b8e020a351978196.png-wh_ "/>

[Email protected] data]# chmod 755. htpasswd

8. Visit again

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/09/ff710948b94519b2cb0d0eac3ad01dc8.png-wh_500x0-wm_3 -wmp_4-s_4046699716.png "title=" 123.png "alt=" Ff710948b94519b2cb0d0eac3ad01dc8.png-wh_ "/>

HTPASSWD usage is as follows:

-c:=create, create an encrypted file
-N: Do not update encrypted files, only the updated user name password is displayed on the screen
-M: Encrypt the password using the MD5 algorithm (default)
-D: Encrypt passwords using the crypt algorithm
-P: Password is not encrypted, that is, the plaintext password
-S: Encrypt passwords using the SHA algorithm
-B: Enter the user name and password at the command line instead of the password as prompted
-D: Delete the specified user

This article is from the "Discover new things" blog, make sure to keep this source http://shenj.blog.51cto.com/5802843/1980227

Apache user authentication, domain jump, Apache access log

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.