Nginx打点服务器配置

什么是打点服务器 他的作用是什么

打点服务器就是记录用户行为的服务器

单独从应用独立出来 目的就是为了减轻应用服务器压力

效果如下:

10.0.1.1 - - [05/Feb/2020:16:39:11 -0500] "GET /dig?time=2020%2F2%2F6%20%E4%B8%8B%E5%8D%882%3A08%3A11&url=file%3A%2F%2F%2FC%3A%2FUsers%2FAdministrator%2FDesktop%2F%25E6%2589%2593%25E7%2582%25B9%25E6%25B5%258B%25E8%25AF%2595%2Findex.html&refer= HTTP/1.1" 200 43 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3710.0 Safari/537.36" "-"

1 前端上报dadian.js


$(()=>{
$.get("http://10.0.1.101:8008/dig",{ //http://10.0.1.101:8008/dig 打点服务器地址
"time" : gettime(),
"url" : geturl(),
"refer": getrefer(),
// "us" : getuser_agent(),
//"cookie": getcookie()
// ip 和 user_agent可以通过nginx直接获得
}) })
// gettime(); //js获取当前时间
// geturl(); //js获取客户端当前url
// getrefer(); //js获取客户端当前页面的上级页面的url
// getuser_agent(); //js获取客户端类型
// getcookie() //js获取客户端cookie function gettime(){
var nowDate = new Date();
return nowDate.toLocaleString();
}
function geturl(){
return window.location.href;
}
function getrefer(){
return document.referrer;
}
function getcookie(){
return document.cookie;
}
function getuser_agent(){
return navigator.userAgent;
}

nginx配置 nginx.conf

最好使用编译安装的nginx 很多集成环境没有带需要ngx_http_empty_gif_module


#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 8008;
server_name localhost; #charset koi8-r; access_log logs/dig.log main; location = /dig {
empty_gif;
error_page 405 =200 $request_uri;
}
} }

Nginx打点服务器配置的更多相关文章

  1. Nginx Web服务器配置

    Nginx是一个轻量级高性能的web服务器,它是为快速响应大量静态文件请求和高效利用系统资源而设计的.与apache使用面向进程或线程的方式处理请求不同,nginx使用异步事件驱动模型在连接高并发的情 ...

  2. nginx图片服务器配置

    worker_processes ; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/erro ...

  3. nginx静态服务器配置

    1. nginx安装 在 Ubuntu 下,可以舍去编译安装的过程,直接 apt-get sudo apt-get install nginx sudo service nginx start 2. ...

  4. Nginx+Swoole服务器配置

    nginx 配置 server { listen 80; server_name www.swoole.com; root /data/wwwroot/www.swoole.com; location ...

  5. nginx 代理服务器配置双向证书验证

    生成证书链 用脚本生成一个根证书, 一个中间证书(intermediate), 三个客户端证书. 脚本来源于(有修改)https://stackoverflow.com/que... 中间证书的域名为 ...

  6. nginx 文件服务器配置,模板配置文件,有注释

    # For more information on configuration, see: # * Official English Documentation: http://nginx.org/e ...

  7. Nginx HTTP服务器配置模板

    https://github.com/h5bp/server-configs-nginx

  8. 【T电商 3】Nginx的Http(图片)服务器配置+ftp上传使用说明

    在前两篇博客中提到了搭建Nginx和Ftp服务器,在本篇博客,主要是介绍Nginx的配置文件的使用,怎样修改配置文件使其成为一个图片服务器. 一.Nginx图片服务器配置 <span style ...

  9. 【Ts 3】Nginx的Http(图片)服务器配置+ftp上传使用说明

    在前两篇博客中提到了搭建Nginx和Ftp服务器,在本篇博客,主要是介绍Nginx的配置文件的使用,怎样修改配置文件使其成为一个图片服务器. 一.Nginx图片服务器配置 <span style ...

随机推荐

  1. VUE中登录密码显示与隐藏的最简设计——基于iview

    目录 VUE中登录密码显示与隐藏的最简设计--基于iview 1.背景 2.实现最终效果 2.1 隐藏密码 2.2 显示密码 3.实现思路 3.1 v-if判断当前密码显示状态 3.2 密码隐藏状态 ...

  2. js 打开新窗口方式

    之前的项目,有个功能是下载文件,这里只要在浏览器输入 url 就会下载那个文件了.当时我只是简单得使用 window.open ,但是却会被浏览器进行拦截,要手动开启才行,然后就搜索研究其他方法,就看 ...

  3. "长辈牌"电子产品:有一种评论朋友圈叫给你打电话

    一.长辈们使用电子产品的姿势集合 先问你一个问题:「怎么下载搜狗输入法?」 (非广告) 摁?看到这篇文章的你可能都有点懵,不就下载安装就完了吗?但是,真的就只是这样吗? 前一段时间,当家里的长辈问到我 ...

  4. Python - requests发送请求报错:UnicodeEncodeError: 'latin-1' codec can't encode characters in position 13-14: 小明 is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.

    背景 在做接口自动化的时候,Excel作为数据驱动,里面存了中文,通过第三方库读取中文当请求参数传入 requests.post() 里面,就会报错 UnicodeEncodeError: 'lati ...

  5. vue移动端字体大小设置

    const setRemUnit = () => { const docEl = document.documentElement; // IPhone6下750像素来设计,实际像素375px, ...

  6. Linux下git使用

    一.安装 本人使用的是centos 7,首先安装git 1.下载git:wget https://Github.com/Git/Git/archive/v2.3.0.tar.gz 2.下载之后解压:t ...

  7. java中的对象 方法 引用 等一些抽象的概念是什么意思呢?

    2020-03-14 最近这一段时间有点忙,好久都没有更新博客了,之后我会一直坚持下去的,和大家一同进步的. 这段时间一直在学java,相信刚开始学习java的小白,刚开始接触那么些抽象的概念一定和我 ...

  8. Python模块二

    os模块是与操作系统交互的一个接口​ <em>#和文件夹相关 os.makedirs('dirname1/dirname2')    可生成多层递归目录 os.removedirs('di ...

  9. springboot项目中thymeleaf布局应用

    .katex { display: block; text-align: center; white-space: nowrap; } .katex-display > .katex > ...

  10. Java 创建、编辑、删除Excel命名区域

    Excel命名区域,即对指定单元格区域进行命名,以便对单元格区域引用,如在公式运用中可以引用指定命名区域进行公式操作.在创建命名区域时,可针对整个工作簿来创建,即workbook.getNameRan ...