nginx配置某url不做https跳转:

server {    
listen 80;    
server_name  www.xxx.com;    
root /code;

location / {        
#如果url不匹配这个则进行跳转https,匹配则走本地的root查询内容        
if ($request_uri !~ '^/abc/') {            
return 301 https://$server_name$request_uri;        
}    
}
}

server {    ....    
listen 443;    
server_name  www.xxx.com;    
....
}

使用nginx负载均衡时,将后端请求超时的服务器流量平滑的切换到另一台上:

server {    
listen 80;    
server_name  www.xxx.com;

location / {        
proxy_pass http://192.168.2.219:8080;         
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;    
}
}

根据nginx日志查询uv和pv:
1.根据访问IP统计UV:
# awk ‘{print $1}’  access.log|sort | uniq -c |wc -l

2.统计访问URL统计PV:
# awk ‘{print $7}’ access.log|wc -l

3.查询访问最频繁的URL:
# awk ‘{print $7}’ access.log|sort | uniq -c |sort -n -k 1 -r|more

4.查询访问最频繁的10个IP:
# awk ‘{print $1}’ access.log|sort | uniq -c |sort -n -k 1 -r| head -n 10

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注