ts2009 发表于 2018-11-15 09:45:40

linux的Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间介绍

# cd /data/wwwroot/test.com  # ls
  adminindex.html
  # vim 1.gif
  # echo "dgagadgadgs" > /data/wwwroot/test.com/2.js
  # curl -x127.0.0.1:80 test.com/1.gif
  dggagadggagdag
  # curl -x127.0.0.1:80 test.com/2.js
  dgagadgadgs
  # curl -x127.0.0.1:80 test.com/index.html
  “test.com”
  # cat /tmp/test.com.log
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  # curl -x127.0.0.1:80 test.com/index.html
  “test.com”
  # cat /tmp/test.com.log
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  # curl -x127.0.0.1:80 test.com/2.js
  dgagadgadgs
  # cat /tmp/test.com.log
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  # curl -x127.0.0.1:80 test.com/2.jsagdaga
  
  404 Not Found
  
  404 Not Found
  nginx/1.12.1
  
  
  # cat /tmp/test.com.log
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  127.0.0.1 - test.com "/index.html" 200 "-" "curl/7.29.0"
  127.0.0.1 - test.com "/2.jsagdaga" 404 "-" "curl/7.29.0"
  # curl -x127.0.0.1:80 -I test.com/2.js
  HTTP/1.1 200 OK
  Server: nginx/1.12.1
  Date: Thu, 04 Jan 2018 10:56:11 GMT
  Content-Type: application/javascript
  Content-Length: 12
  Last-Modified: Thu, 04 Jan 2018 10:51:59 GMT
  Connection: keep-alive
  ETag: "5a4e074f-c"
  Expires: Thu, 04 Jan 2018 22:56:11 GMT
  Cache-Control: max-age=43200//43200秒表示过期时间12小时,与配置文件里一样。
  Accept-Ranges: bytes

页: [1]
查看完整版本: linux的Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间介绍