apache访问日志
生活随笔
收集整理的這篇文章主要介紹了
apache访问日志
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
apache訪問日志
[root@chy ~]# ls /usr/local/apache2.4/logs/ access_log error_log httpd.pid (查看apache日志路徑,其中access是訪問日志,error是出錯日志) [root@chy ~]# vim /usr/local/apache2.4/conf/httpd.conf (在主配置文件里面定義訪問日志)LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedLogFormat "%h %l %u %t \"%r\" %>s %b" common (common格式詳解其中%h為來源IP,%l是用戶,%u也是用戶,%t是時間,%r是requst行為,%s是狀態碼,%b是大小) (combined詳解 其中%h為來源IP,%l是用戶,%u也是用戶(由HTTP認證系統得到的訪問該網頁的客戶名。有認證時才有效,輸出中的符號 "-" 表示此處信息無效。),%t是時間,%r是requst行為,%s是狀態碼,%b是大小(最后這項是返回給客戶端的不包括響應頭的字節數。),\"%{User-Agent}i\"是用戶代理(此項是客戶瀏覽器提供的瀏覽器識別信息。),\"%{Referer}i\此項指明了該請求是從被哪個網頁提交過來的。 [root@chy ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf (進入到虛擬主機配置文件中) [root@chy ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf <VirtualHost *:80>DocumentRoot "/data/wwwroot/111.com"ServerName www.111.comServerAlias www.exaple.com 222.com#<Directory /data/wwwroot/111.com>#<filesMatch 123.php>#AllowOverride AuthConfig #AuthName "111.com user auth"#AuthType Basic# AuthUserFile /data/.htpasswd # require valid-user# </FilesMatch>#</Directory><IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{HTTP_HOST} !^111.com$RewriteRule ^/(.*)$ http://111.com/$1 [R=301,L]</IfModule>ErrorLog "logs/111.com-error_log"CustomLog "logs/111.com.com-access_log" combined</VirtualHost> 將 ErrorLog "logs/111.com-error_log"CustomLog "logs/111.com-access_log" combined 這段內容的access日志變為combined格式如下是一位博主寫的apache訪問日志詳解,有需要的可以看看。
http://blog.csdn.net/zhuying_linux/article/details/6773912
? ? ?本文轉自我不是瘦子51CTO博客,原文鏈接:http://blog.51cto.com/chy940405/2047869,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的apache访问日志的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HTML和XHTML的区别
- 下一篇: 学学python(4):面向对象及类,模