nginx安装

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

转载于:https://www.cnblogs.com/kang-code1/p/11177226.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值