网站建设资讯

NEWS

网站建设资讯

Apache访问日志不记录静态文件#171221

hellopassdw

成都创新互联专业为企业提供运城网站建设、运城做网站、运城网站设计、运城网站制作等企业网站建设、网页设计与制作、运城企业网站模板建站服务,十载运城做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

访问日志不记录指定类型的文件 网站大多元素为静态文件,如图片,css,js等,这些元素可以不用记录 把虚拟主机配置文件改成如下: :80> DocumentRoot "/data/wwwroot/www.111.com ServerName www.111.com ServerAlias 111.com SetEnvIf Request_URI "..gif$" img SetEnvIf Request_URI "..jpg$" img SetEnvIf Request_URI "..png$" img SetEnvIf Request_URI "..bmp$" img SetEnvIf Request_URI "..swf$" img SetEnvIf Request_URI "..js$" img SetEnvIf Request_URI "..css$" img CustomLog "logs/111.com-access_log" combined env=!img 重新加载配置文件-t,graceful mkdir /data/wwwroot/www.111.com/images #创建目录,并在这目录下上传一个图片 curl -x 127.0.0.1:80 -I 111.com/images/111.jpg tail /usr/local/apache2.4/logs/111.com_access_log

[root@localhost ~]# vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf # 43 # 44 45 RewriteEngine on 46 RewriteCond %{HTTP_HOST} !^111.com$ 47 RewriteRule ^/(.*)$ http://111.com/$1 [R=301,L] 48 49 ErrorLog "logs/111.com-error_log" 50 SetEnvIf Request_URI ".*.gif$" img 51 SetEnvIf Request_URI ".*.jpg$" img 52 SetEnvIf Request_URI ".*.png$" img 53 SetEnvIf Request_URI ".*.bmp$" img 54 SetEnvIf Request_URI ".*.swf$" img 55 SetEnvIf Request_URI ".*.js$" img 56 SetEnvIf Request_URI ".*.css$" img 57 CustomLog "logs/111.com-access_log" combined env=!img 58

[root@localhost ~]# curl -x 127.0.0.1:80 111.com/1111.jpg -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 13:27:47 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1

[root@localhost ~]# tail /usr/local/apache2.4/logs/111.com-access_log 127.0.0.1 - - [04/Nov/2017:14:33:52 +0800] "HEAD http://111.com/user.php HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:14:34:03 +0800] "GET http://111.com/user.php HTTP/1.1" 200 10 "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:14:35:24 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:14:35:25 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0"

[root@localhost ~]# /usr/local/apache2.4/bin/apachectl -t Syntax OK [root@localhost ~]# /usr/local/apache2.4/bin/apachectl graceful [root@localhost ~]# curl -x 127.0.0.1:80 111.com/1111.jpg -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 13:30:09 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1

[root@localhost ~]# tail /usr/local/apache2.4/logs/111.com-access_log 127.0.0.1 - - [04/Nov/2017:14:33:52 +0800] "HEAD http://111.com/user.php HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:14:34:03 +0800] "GET http://111.com/user.php HTTP/1.1" 200 10 "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:14:35:24 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:14:35:25 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0"

[root@localhost ~]# curl -x 127.0.0.1:80 111.com/1111.jpg1 -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 13:30:59 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1 [root@localhost ~]# tail /usr/local/apache2.4/logs/111.com-access_log 127.0.0.1 - - [04/Nov/2017:14:34:03 +0800] "GET http://111.com/user.php HTTP/1.1" 200 10 "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:14:35:24 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:14:35:25 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:30:59 +0800] "HEAD HTTP://111.com/1111.jpg1 HTTP/1.1" 404 - "-" "curl/7.29.0

[root@localhost ~]# curl -x 127.0.0.1:80 111.com/1111 -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 13:31:43 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1 [root@localhost ~]# tail /usr/local/apache2.4/logs/111.com-access_log 192.168.9.1 - - [04/Nov/2017:14:35:24 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:14:35:25 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:30:59 +0800] "HEAD HTTP://111.com/1111.jpg1 HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:31:43 +0800] "HEAD HTTP://111.com/1111 HTTP/1.1" 404 - "-" "curl/7.29.0"

[root@localhost ~]# cd /data/wwwroot/111.com/ [root@localhost 111.com]# ls index.php user.php [root@localhost 111.com]# rz

上传一张图片为1111.png

[root@localhost 111.com]# ls 1111.png index.php user.php [root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/1111.png -I HTTP/1.1 200 OK Date: Sat, 04 Nov 2017 13:36:39 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Last-Modified: Sat, 04 Nov 2017 13:36:39 GMT ETag: W/"99ad-560d9271dfe00" Accept-Ranges: bytes Content-Length: 39341 Content-Type: image/png

Windows下访问浏览器111.com/1111.png

[root@localhost 111.com]# tail /usr/local/apache2.4/logs/111.com-access_log 192.168.9.1 - - [04/Nov/2017:14:35:25 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:30:59 +0800] "HEAD HTTP://111.com/1111.jpg1 HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:31:43 +0800] "HEAD HTTP://111.com/1111 HTTP/1.1" 404 - "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:21:37:22 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"

[root@localhost 111.com]# vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf 43 # 44 45 RewriteEngine on 46 RewriteCond %{HTTP_HOST} !^111.com$ 47 RewriteRule ^/(.*)$ http://111.com/$1 [R=301,L] 48 49 ErrorLog "logs/111.com-error_log" 50 SetEnvIf Request_URI ".*.gif$" img 51 SetEnvIf Request_URI ".*.jpg$" img 52 SetEnvIf Request_URI ".*.png$" img 53 SetEnvIf Request_URI ".*.bmp$" img 54 SetEnvIf Request_URI ".*.swf$" img 55 SetEnvIf Request_URI ".*.js$" img 56 SetEnvIf Request_URI ".*.css$" img 57 CustomLog "logs/111.com-access_log" combined 58 [root@localhost 111.com]# /usr/local/apache2.4/bin/apachectl graceful

[root@localhost 111.com]# tail /usr/local/apache2.4/logs/111.com-access_log 192.168.9.1 - - [04/Nov/2017:14:44:00 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:30:59 +0800] "HEAD HTTP://111.com/1111.jpg1 HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:31:43 +0800] "HEAD HTTP://111.com/1111 HTTP/1.1" 404 - "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:21:37:22 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:21:41:58 +0800] "GET /1111.png HTTP/1.1" 200 39341 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)"

[root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/1111.png -I HTTP/1.1 200 OK Date: Sat, 04 Nov 2017 13:42:38 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Last-Modified: Sat, 04 Nov 2017 13:42:38 GMT ETag: W/"99ad-560d9271dfe00" Accept-Ranges: bytes Content-Length: 39341 Content-Type: image/png [root@localhost 111.com]# tail /usr/local/apache2.4/logs/111.com-access_log 192.168.9.1 - - [04/Nov/2017:14:50:27 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:50:49 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 192.168.9.1 - - [04/Nov/2017:14:51:04 +0800] "GET /user.php HTTP/1.1" 200 10 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:27:15 +0800] "HEAD HTTP://111.com HTTP/1.1" 200 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:27:47 +0800] "HEAD HTTP://111.com/1111.jpg HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:30:59 +0800] "HEAD HTTP://111.com/1111.jpg1 HTTP/1.1" 404 - "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:21:31:43 +0800] "HEAD HTTP://111.com/1111 HTTP/1.1" 404 - "-" "curl/7.29.0" 192.168.9.1 - - [04/Nov/2017:21:37:22 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 192.168.9.1 - - [04/Nov/2017:21:41:58 +0800] "GET /1111.png HTTP/1.1" 200 39341 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)" 127.0.0.1 - - [04/Nov/2017:21:42:38 +0800] "HEAD HTTP://111.com/1111.png HTTP/1.1" 200 - "-" "curl/7.29.0"

43 # 44 45 RewriteEngine on 46 RewriteCond %{HTTP_HOST} !^111.com$ 47 RewriteRule ^/(.*)$ http://111.com/$1 [R=301,L] 48 49 ErrorLog "logs/111.com-error_log" 50 SetEnvIf Request_URI ".*.gif$" img 51 SetEnvIf Request_URI ".*.jpg$" img 52 SetEnvIf Request_URI ".*.png$" img 53 SetEnvIf Request_URI ".*.bmp$" img 54 SetEnvIf Request_URI ".*.swf$" img 55 SetEnvIf Request_URI ".*.js$" img 56 SetEnvIf Request_URI ".*.css$" img 57 CustomLog "logs/111.com-access_log" combined env=!img 58

使用场景,一般日志保存是请求的页面信息,而不是保存具体到某一张图片,这样不仅会消耗并且浪费磁盘空间,也造成了不必要信息记录,查找会更加麻烦。


修改与171221


网页名称:Apache访问日志不记录静态文件#171221
分享URL:http://cdweb.net/article/chochs.html