shallow丿ovephp
[root@localhost 111.com]# vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf 44 <IfModule mod_rewrite.c> 45 RewriteEngine on 46 RewriteCond %{HTTP_HOST} !^111.com$ 47 RewriteRule ^/(.*)$ http://111.com/$1 [R=301,L] 48 </IfModule> 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 "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img 58 </VirtualHost>
-l以當前系統切割日誌,若不指定以UTC切割,國內爲CST,差幾個時區 按天記錄,換算爲秒爲86400scss
[root@localhost 111.com]# /usr/local/apache2.4/bin/apachectl -t Syntax OK [root@localhost 111.com]# /usr/local/apache2.4/bin/apachectl graceful [root@localhost 111.com]# ls /usr/local/apache2.4/logs/ 111.com-access_log abc.com-access_log access_log httpd.pid 111.com-error_log abc.com-error_log error_log [root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/index.php hello!111.com
[root@localhost 111.com]# cat /usr/local/apache2.4/logs/111.com-access_20171104.log 127.0.0.1 - - [04/Nov/2017:22:30:22 +0800] "GET HTTP://111.com/index.php HTTP/1.1" 200 13 "-" "curl/7.29.0 [root@localhost 111.com]# ls /usr/local/apache2.4/logs/ 111.com-access_20171104.log 111.com-error_log abc.com-error_log error_log 111.com-access_log abc.com-access_log access_log httpd.pid
[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 14:35:19 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Last-Modified: Sat, 04 Nov 2017 14:35:19 GMT ETag: W/"99ad-560d9271dfe00" Accept-Ranges: bytes Content-Length: 39341 Content-Type: image/png [root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/1111.png1 -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 14:35:24 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1 [root@localhost 111.com]# cat /usr/local/apache2.4/logs/111.com-access_20171104.log 127.0.0.1 - - [04/Nov/2017:22:30:22 +0800] "GET HTTP://111.com/index.php HTTP/1.1" 200 13 "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:22:35:24 +0800] "HEAD HTTP://111.com/1111.png1 HTTP/1.1" 404 - "-" "curl/7.29.0