11.18 Apache user authentication 11.19 11.20 domain name jump 11.21 Apache Access log

Source: Internet
Author: User
Tags apache access log

11.18 Apache user authentication

Change the contents of a virtual host
Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf

Add user name and password
? /usr/local/apache2.4/bin/htpasswd-c-m/data/.htpasswd aming
-C is the creation of-m specified type

View the generated password document contents

He's gone up there already. htpasswd directory, then create in memory does not require-C

Specify the domain name hosts on WI
C:\Windows\System32\drivers\etc

Authentication: No account password hint status code 401 is wrong authentication
Enter the correct account password prompt has status code 200 is correct


Change the configuration file
Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf

Check configuration file and load

Specify 123.php
vim/data/wwwroot/111.com/123.php

Test at this time without u can also display, the status code is 200, only in the back of the 123.php, it will prompt the status code is 401, because the 123.php has been limited

Need to specify user and password to correct

11.19 11.20 Domain name jump

Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf

Check configuration file and reload

Check to see if the rewrite module is loaded before testing

No loading is going to be loaded under Config file
Vim/usr/local/apache2.4/conf/httpd.conf
Enter/rewite search to remove the # number

Check the configuration file and reload, check if the rewrite module is loaded, and now load the

-I is not displaying content, only show status code

The following instructions jump to a successful

Status Code display error 403, granted in config file changed to denied
Vim/usr/local/apache2.4/conf/httpd.conf
11.21 Apache Access Log

Log path
Ls/usr/local/apache2.4/logs/111.com-access_log
Cat/usr/local/apache2.4/logs/111.com-access_log
View the contents of it

Edit the master configuration file
Input/log find Logformat, here are 2 lines, is the log of 2 formats

%h is the IP%l is the user%u password%t time%r behavior URL%>s state?%b size
%{user-agent}i is used as an agent, it is accessed through the browser, so the browser is the user agent, it shows the field is the browser-related characters, if you open with curl, is to display the curl-related characters
%{referer}i record the last visited URL
Change the configuration file
Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf
Common change to combined

Load

Browser re-open

Check the log again, the contents of the log are different

11.18 Apache user authentication 11.19 11.20 domain name jump 11.21 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.