国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ?? ? ???? ??? NGINX? ????? PV, UV, ?? IP? ??? ??????

NGINX? ????? PV, UV, ?? IP? ??? ??????

May 19, 2023 am 09:13 AM
nginx ip

概念:

  • uv(unique visitor):獨立訪客,將每個獨立上網(wǎng)電腦(以cookie為依據(jù))視為一位訪客,一天之內(nèi)(00:00-24:00),訪問您網(wǎng)站的訪客數(shù)量。一天之內(nèi)相同cookie的訪問只被計算1次

  • PV(頁面瀏覽量)是指用戶每次訪問網(wǎng)站時所產(chǎn)生的點擊量或頁面瀏覽量,記錄為1次。用戶對同一頁面的多次訪問,訪問量值累計

  • 統(tǒng)計獨立ip:00:00-24:00內(nèi)相同ip地址只被計算一次,做網(wǎng)站優(yōu)化的朋友最關(guān)心這個

先聲明下環(huán)境,此次運行的nginx版本1.7,后端tomcat運行的是動態(tài)交互程序(需進行用戶認證,如果是靜態(tài)頁面則抓不到cache值,$http_cookie是空值),就是這樣;

nginx日志文件配置

http {
  include    mime.types;
  default_type application/octet-stream;
  log_format main '$remote_addr - [$time_local] "$request" '
            ' - $status "user_cookie:$guid" ';
 #user_cookie為日志顯示字符,$guid為變量,具體內(nèi)容在下面定義,也可在日志格式里寫入$http_cookie 顯示完整的cookie內(nèi)容<br>
  sendfile    on;
  keepalive_timeout 65;
    upstream backserver {
    ip_hash;
    server 1.1.2.2:8080;
    server 1.1.2.3:8080;
}
server {
    listen    80;
    server_name localhost;
    #if ( $http_cookie ~* "(.*)$") 匹配所有內(nèi)容
    if ( $http_cookie ~* "csid=([a-z0-9]*)"){
        set $guid $1;
    }  #只匹配csid字符信息,此處為正則表達式<br>
    access_log logs/host.access.log main;
     location ~* ^(.*)$ {
       #limit_req zone=allips burst=1 nodelay;
 
       proxy_pass http://backserver;
       proxy_set_header host $host;
       proxy_set_header x-real-ip $remote_addr;
       proxy_set_header remote-host $remote_addr;
       proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
       client_max_body_size 8m;
       }
    error_page  500 502 503 504 /50x.html;
    location = /50x.html {
      root  html;
    }
}

注:$http_cookie這個里面的值是一個一個cookie的值,中間以“;”分隔

日志輸出格式

192.168.40.2 - [02/nov/2016:15:44:35 +0800] "get /wcm/app/main/refresh.jsp?r=1478072325778 http/1.1" - 200 "user_cookie:7f00000122a5597c46607b1c0a7ec016"
192.168.40.2 - [02/nov/2016:15:44:35 +0800] "get /webpic/w0201611/w020161102/w020161102566715167404.jpg http/1.1" - 200 "user_cookie:7f00000122a5597c46607b1c0a7ec016"
119.255.31.109 - [02/nov/2016:15:44:36 +0800] "get /wcm/app/main/refresh.jsp?r=1478072510132 http/1.1" - 200 "user_cookie:7f000001237921be9237838aec65704d"
119.255.31.109 - [02/nov/2016:15:44:36 +0800] "get /wcm/app/message/message_query_service.jsp?readflag=0&msgtypes=1%2c2%2c3 http/1.1" - 200 "user_cookie:7f000001237921be9237838aec65704d"
192.168.40.2 - [02/nov/2016:15:44:37 +0800] "get /wcm/app/message/message_query_service.jsp?readflag=0&msgtypes=1%2c2%2c3 http/1.1" - 200 "user_cookie:7f00000123d3bf2345115eaac21f71e0"
192.168.40.2 - [02/nov/2016:15:44:37 +0800] "get /wcm/app/message/message_query_service.jsp?readflag=0&msgtypes=1%2c2%2c3 http/1.1" - 200 "user_cookie:7f00000123ef73896df98eda9950944e"
192.168.40.2 - [02/nov/2016:15:44:37 +0800] "get /wcm/app/message/message_query_service.jsp?readflag=0&msgtypes=1%2c2%2c3 http/1.1" - 200 "user_cookie:7f00000123fe0f9c397e1a8f0c4f044b"
192.168.40.2 - [02/nov/2016:15:44:37 +0800] "get /wcm/app/main/refresh.jsp?r=1478072511427 http/1.1" - 200 "user_cookie:7f00000123a465b7ea1de0af0ae671b7"
119.255.31.109 - [02/nov/2016:15:44:38 +0800] "get /wcm/app/message/message_query_service.jsp?readflag=0&msgtypes=1%2c2%2c3 http/1.1" - 200 "user_cookie:7f00000123d89b11302df80ae773c900"

pv統(tǒng)計

可統(tǒng)計單個鏈接地址訪問量:

[root@localhost logs]# grep index.shtml host.access.log | wc -l

總pv量:

[root@localhost logs]# awk &#39;{print $6}&#39; host.access.log | wc -l

獨立ip

[root@localhost logs]# awk &#39;{print $1}&#39; host.access.log | sort -r |uniq -c | wc -l

uv統(tǒng)計

[root@localhost logs]# awk &#39;{print $10}&#39; host.access.log | sort -r |uniq -c |wc -l

cookie 測試頁面

關(guān)于種cookie,可以使用下面的html代碼,編輯,添加需要種的cookie

#index.html
 <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk">
<meta http-equiv="refresh" content="10"> //為了方便測試,每10秒刷新一次頁面
</head>
<body>
<h1>test.test.com域測試</h1>
下面列出了該域的cookie<br>
<p>
<script>
document.cookie="guid=a1ud8e5512451111111111"; //種cookie,追加
document.cookie="city=beijing"; //種cookie,追加
document.write(document.cookie); //列出已經(jīng)存在的
</script>
</p>
</body>
</html>

? ??? NGINX? ????? PV, UV, ?? IP? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
Nginx vs. Apache : ? ??? ?? ?? Nginx vs. Apache : ? ??? ?? ?? Apr 21, 2025 am 12:08 AM

Nginx? ?? ?? ??? ???? ? ? ??? ?? Apache? ??? ?? ? ?? ??? ??? ????? ? ?????. 1.NGINX? ??? ? ?? ?? ??? ???? ?? ???? ?????. 2. Aapache? ???? ??? ?? ???? ???? ??? ?? ??? ?????.

Nginx ? Apache : ?? ??? ?? Nginx ? Apache : ?? ??? ?? Apr 26, 2025 am 12:01 AM

Nginx? Apache? ?? ?? ? ??? ??? ??? ??? ?? ??? ???????. 1.NGINX? ??? ? ??? ????? ?? ?? ?? ????? ?????. 2. Apache? ?? ? ??? ?? ??? ??? ??? ??? ????? ?????.

PHP ??? ??? ? PHP ??? ???? ??? ?????? PHP ??? ???? ? ?? ???? ?? PHP ??? ??? ? PHP ??? ???? ??? ?????? PHP ??? ???? ? ?? ???? ?? May 23, 2025 pm 08:33 PM

PHP ??? ?? ?? ???? ??? ? ????. 1. ?? ?? ???? "PHP ?? ??"? ?? ???? ????? ?????. 2. ??? ?? ?? ????? ?? ? ??? ?? ????? ?? ???????. 3. IDE?? ???? ?? ??? ??? ??????. 4. ??? PHP ?? ?? ?? ?? ?? ???? ???? ???????.

nginx, ?? ?? ?? ? ?? ??? ?? ? ? nginx, ?? ?? ?? ? ?? ??? ?? ? ? May 16, 2025 pm 10:54 PM

Nginx? ?? ?? ??? ?? ??? ???? ?? ? ??? ????? ???? ? ???? ??? ?? ?????. 1) ?? ?? ??? ????? /etc/nginx/nginx.conf???. ??? nginx-t ??? ???? ??? ??? ? ? ????. 2) ?? ???? ?? ?? (? : ???, Worker_Processes) ? HTTP ?? (? : log_format)? ?????. ??? ??? ?? ??? ?? ??? ?? ? ??? ?????. ??? ???? ?? ?? ??? ?? ???? ??? ? ????.

Linux? ??? ???? ???? ??? ?????? Ulimit? ???? ??? Linux? ??? ???? ???? ??? ?????? Ulimit? ???? ??? May 29, 2025 pm 11:09 PM

Linux System? Ulimit ??? ?? ??? ???? ???? ??? ??? ??? ?????. 1. ulimit? ?? ??? ? (-n), ??? ?? (-v), ??? ??? (-u) ?? ?? ? ??? ?? ? ? ?????. 2. ULIMIT-N2048? ?? ?? ??? ?? ULIMIT ??? ?? ????? ?? ???? ?????. 3. ??? ? ??? ???? /etc/security/limits.conf ? pam ?? ??? ???? sessionRequiredPam_limits.so? ???????. 4. SystemD ???? ?? ???? lim? ???????.

Debian Nginx ?? ??? ?????? Debian Nginx ?? ??? ?????? May 29, 2025 pm 11:06 PM

Debian ????? Nginx? ?? ? ? ??? ???? ????. ?? ??? ?? ?? ??? ?? : ??? ??? ? ? ?? ???? ??? ?? ?? NGINX ???? ??? ??? ?? ?? ??? ??????. ??? ?? ?? : NGINX? ???? ??? ???? ??? ???? ?? ?? ????? ?? ?????. HTTP ??? ?? : HTTP ???? ??? ?? ??? ???? ??? ?? ?? ? ?? ??? ???? ? ????. ?? ?? ?? worker_connections : ? ??? ???? ?? ? ??? ?? ?? ?? ???? ????? 1024? ?????. Multi_accept : ?? ?? ?? ??? ????? ?? ?? ??? ??????. ??

Nginx? ?? : ? ???? ???? ????? Nginx? ?? : ? ???? ???? ????? May 08, 2025 am 12:07 AM

nginxserveswebcontentandactsasareverseproxy, loadbalancer, andmore.1) itefficientservesstaticcontentikehtmllandimages.2) itfunctionsAresAreSeareverseProxyAndloadbalancer, ?? TrafficacrossServers.3) nginxenhancesperformancethroughcaching.4) Itofferssecur

NGINX ?? ?? : ???? ?? ?? ? ?? NGINX ?? ?? : ???? ?? ?? ? ?? May 05, 2025 am 12:09 AM

Nginx? ???? ??? ?? ?? ? ????? ??? ?????. 1. ?? ????, 2. ?? ?? ??, 3. ?? ???. ??? ???? ?? ?? ??? ???? ?? ??? ??? ???? ?? ? ??? ??? ? ??? ????? ?? 404, 502, 504? ?? ??? ????? ??? ? ????.

See all articles