nginx echo模块 静态加载 与 动态加载

一,简介

nginx 的 echo 模块,可以使你的nginx能输出自定义的信息.

二,安装

下载安装包

点击进入GITHUB安装地址
注意自己的版本,选择与自己nginx兼容的版本下载哦
在这里插入图片描述

解压

下载后 上传到任意文件夹 解压

 tar -zxvf echo-nginx-module-0.62.tar.gz 

编译

如果已安装过nginx 输入获取./configure参数

	nginx -V 

没有安装过 可以自行搜索一下nginx安装的相关文章

	./configure --user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl=/www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/nginx/src/nginx-dav-ext-module

静态加载模块

上面是我获取到我已安装的 编辑参数 把echo模块加入到上面即可

--add-module=/www/server/nginx/src/echo-nginx-module 

而后

 make  
 make install   

动态加载模块

动态加载 与静态加载不同之处在于添加到./configure的内容不同

--add-dynamic-module=/www/server/nginx/src/echo-nginx-module

拼接起来就是
./configure --user=www --group=www --prefix=/www/server/nginx…–add-dynamic-module=/www/server/nginx/src/echo-nginx-module

而后

make
make install

操作完成后 在 /nginx/modules/ 目录下 会生成一个 ngx_http_echo_module.so 文件
我们只需在nginx.conf 的 全局块中动态引入模块即可

load_module /www/server/nginx/modules/ngx_http_echo_module.so; 

输出

在这里插入图片描述
在这里插入图片描述
点击查看更多echo变量

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值