模块名:
echo-nginx-module
模块功能:
在nginx的配置文件中,可以配置类似”echo”,”sleep”,”time”,”exec”等类似shell风格的指令。
此模块不随nginx一起分发。
echo主要包含命令、过滤和变量这三个大类。
模块地址:
https://github.com/openresty/echo-nginx-module
模块安装:
官网说明
https://github.com/openresty/echo-nginx-module#installation
安装流程
wget -S https://github.com/openresty/echo-nginx-module/archive/master.zip unzip master.zip ./configure --prefix=/usr/local/nginx/ --add-module=/usr/local/src/nginx-module/echo-nginx-module-0.61/ --with-http_ssl_module make && make install
echo包含的主要内容
命令
https://github.com/openresty/echo-nginx-module#content-handler-directives
过滤
https://github.com/openresty/echo-nginx-module#filter-directives
变量
https://github.com/openresty/echo-nginx-module#variables
常用形式
官网示例:
https://github.com/openresty/echo-nginx-module#synopsis
展示示例
输出自定义内容
配置文件增加内容
location /hello {
echo -n "hello, ";
echo "world!";
}
测试命令
curl https://c.guanshizhai.online/hello
输出内容:
hello, world!
echo-nginx-module还有更多的示例,可以查看查看官网,这里暂时不列举了。