1.服务器中安装依赖

yum -y install gcc perl pcre-devel openssl openssl-devel

2.上传 LuaJIT-2.0.4.tar.gz 并安装 LuaJIT

tar -zxvf LuaJIT-2.0.4.tar.gz -C /usr/local/src/

cd /usr/local/src/LuaJIT-2.0.4/

make && make install PREFIX=/usr/local/luajit

3.设置 LuaJIT 环境变量

vi /etc/profile

export LUAJIT_LIB=/usr/local/luajit/lib

export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

source /etc/profile

4.创建 modules 文件夹,保存 nginx 依赖的模块

mkdir -p /usr/local/nginx/modules

5.上传 nginx 依赖的模块

set-misc-nginx-module-0.29.tar.gz

lua-nginx-module-0.10.0.tar.gz

ngx_devel_kit-0.2.19.tar.gz

echo-nginx-module-0.58.tar.gz

6.将依赖的模块直接解压到 modules 目录

tar -zxvf lua-nginx-module-0.10.0.tar.gz -C /usr/local/nginx/modules/

tar -zxvf set-misc-nginx-module-0.29.tar.gz -C /usr/local/nginx/modules/

tar -zxvf ngx_devel_kit-0.2.19.tar.gz -C /usr/local/nginx/modules/

tar -zxvf echo-nginx-module-0.58.tar.gz -C /usr/local/nginx/modules/

7.安装 openresty

tar -zxvf openresty-1.9.7.3.tar.gz -C /usr/local/src/

cd /usr/local/src/openresty-1.9.7.3/

编译

./configure --prefix=/usr/local/openresty --with-luajit && make && make install

8.安装 nginx

tar -zxvf nginx-1.8.1.tar.gz -C /usr/local/src/

9.编译 nginx 并支持其他模块

yum install lua-devel -y

cd /usr/local/src/nginx-1.8.1/

./configure --prefix=/usr/local/nginx \

--with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" \

--add-module=/usr/local/nginx/modules/ngx_devel_kit-0.2.19 \

--add-module=/usr/local/nginx/modules/lua-nginx-module-0.10.0 \

--add-module=/usr/local/nginx/modules/set-misc-nginx-module-0.29 \

--add-module=/usr/local/nginx/modules/echo-nginx-module-0.58

一定要分开

make -j2

一定要分开

make install

5 . 自定义采集数据实现

方案一: 基本功能实现

a)     创建页面 index.html,添加埋点代码,放入 nginx 默认目录 nginx/html 下。

Node-3:

cd /var/www/html/    上传页面

service httpd start     开启httpd服务 

service httpd status   查看httpd服务

ps -ef | grep 80       查看进程

node-1:

cd /usr/local/nginx/html

上传js

访问node-1js

Cd ../conf 上传nginx.conf

重启nginx

./nginx -s reload

Cd ../logs    查看tail -f user_defined.log

posted on 2019-07-12 17:07  代码我没动  阅读(217)  评论(0编辑  收藏  举报