nignx日志統(tǒng)計(jì)
1.根據(jù)訪問(wèn)IP統(tǒng)計(jì)UV
awk ‘{print $1}’ access.log|sort | uniq -c |wc -l
2.統(tǒng)計(jì)訪問(wèn)URL統(tǒng)計(jì)PV
awk ‘{print $7}’ access.log|wc -l
3.查詢?cè)L問(wèn)最頻繁的URL
awk ‘{print $7}’ access.log|sort | uniq -c |sort -n -k 1 -r|more
4.查詢?cè)L問(wèn)最頻繁的IP
awk ‘{print $1}’ access.log|sort | uniq -c |sort -n -k 1 -r|more
5.隱藏Nignx版本號(hào)
進(jìn)入nginx配置文件的目錄conf,在http { }里加上server_tokens off ;
如fastcgi.conf或fcgi.conf或fastcgi_params這個(gè)配置文件名也可以自定義的,根據(jù)具
體文件名修改)
找到
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
改為:
fastcgi_param SERVER_SOFTWARE nginx;
沒(méi)有就添加