1. Apache Access LogEnter command cat/usr/local/apache2.4/conf/extra/httpd-vhosts.conf, enter, see,The access log for this virtual machine is inside the/logs/111.com-access_log, enter the command ls/usr/local/apache2.4/logs/, you can see the access log file, see,You can use the command Cat/usr/local/apache2.4/logs/111.
/db/HTTP/1.1"This is the most useful one. First, it tells our server to receive a GET request, second, the resource path of the client request, and third, HTTP/1.1 when the client uses the protocol, the entire format is "% m % U % q % H", that is, "request method/access path/protocol"(6) 200This is a status code sent back to the client by the server. it tells us whether the client's request is successful, or is redirected, or what kind of error is encountered. The value is 200, indicates that th
View Apache log Apache log locationDifferent system locations are different.
widnows
If it is windows, XAMPP should be in existence, go directly to the Apache folder/log/access.log | The
to see if the rewrite module is loaded before testingNo loading is going to be loaded under Config fileVim/usr/local/apache2.4/conf/httpd.confEnter/rewite search to remove the # numberCheck the configuration file and reload, check if the rewrite module is loaded, and now load the-I is not displaying content, only show status codeThe following instructions jump to a successfulStatus Code display error 403, granted in config
One, Apache user authenticationThe function is that when users visit a website, they need to enter a user name and password to enter the site. Some important sites or websites are often authenticated by users to ensure security.# vim/usr/local/apache2.4/conf/extra/httpd-vhosts.confDocumentRoot "/data/wwwroot/111.com"ServerName 111.comServeralias www.example.comAllowOverride authconfig//Turn on the certified switchAuthName "111.com user auth"//Custom c
Rotatelogs is the pipe logger that came with Apache 2.2.
Grammar
Copy code code as follows:Rotatelogs [-l] logfile [rotationtime [offset]] | [Filesizem]
Options-LUse local time instead of GMT time as a time benchmark. Note: using-l in an environment that changes the GMT offset (such as daylight saving time) can lead to unpredictable results.
LogFileIt plus the reference name is the log
there is noThird, Apache access logAccess log records every request from a uservim/usr/local/apache2.4/conf/httpd.conf//Search LogformatLogformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combinedLogformat "%h%l%u%t \"%r\ "%>s%b" commonView logs for 111.comCat/usr/local/apache2.4/logs/111.com-access_logChange the virtual host configuration file
Apache user authenticationOpen the site directly pop-up user name password, correct before you can view the site, this is called Apache user authentication.Edit the configuration file (because we are using Apache virtual host, so we enter the configuration of the virtual host)vim /usr/local/apache2.4/conf/extra/httpd-v
One, Apache access logs do not log static filesMost of the site elements are static files, tablets, CSS, JS, etc., these elements can not be recordedvim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf//Change to the followingChange the virtual host configuration file to the following:DocumentRoot "/data/wwwroot/www.123.com"ServerName www.111.comServeralias 111.c
11.18 Apache user authentication11.19/11.20 Domain Jumphttpd.conf, delete the # in front of Rewrite_module (shared)Curl-x127.0.0.1:80-i 123.com//Status Code 30111.21 Apache Access LogChange the virtual host configuration file to the following:DocumentRoot "/data/wwwroot/lgx168.com"ServerName lgx168.comServeralias www.lgx168.comCustomlog "Logs/lgx168.com-access_lo
, hostname (domain name) is not www.123.com meet conditionRewriterule ^/(. *) $ http://www.123.com/$1 [r=301,l]//define rewrite rules that are not executed until the above conditions are met/usr/local/apache2/bin/apachectl-m|grep-i rewrite//Without this module, you need to edit the configuration file httpd.conf, delete the front of the Rewrite_module (shared) #Curl-x127.0.0.1:80-i 123.com//Status Code 30111.21 Configuring access LogsAccess
JAVA log4j Log File Usage, javalog4j Log File
// 1. Import jar package, log4j-1.2.17.jar// 2. Create the log4j. properties file under src// 3. Configure the properties File/*Log4j. rootLogger (effective for the entire project by d
Operation Steps:One: Define the format of the log in the Apache master configuration fileVim/usr/local/apache2/conf/httpd.confLogformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combinedLogformat "%h%l%u%t \"%r\ "%>s%b" commonLogformat "%h%l%u%t \"%r\ "%>s%b" AlexNote: First define the output format and alias (combined, Common, Alex) of the log
Rotatelogs is the pipe logger that came with Apache 2.2.
Grammar
Copy Code code as follows:
Rotatelogs [-l] logfile [rotationtime [offset]] | [Filesizem]
Options-LUse local time instead of GMT time as a time benchmark. Note: using-l in an environment that changes the GMT offset (such as daylight saving time) can lead to unpredictable results.
LogFileIt plus the reference name is the log
Apache Log Split1. Configure HTTPD master configuration, create a file ending with Conf in the HTTPD sub-configuration directory, and add configuration information2. Create directory, add homepage, restart Service, turn off firewall3, visit the webpage, more refresh several times, view the access logApache Log Analysis
Apache Log Configuration
Sometimes we need to customize the format and content of the Apache default log, such as increasing or decreasing the information logged by the log, changing the format of the default log
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.