首先解释下
nginx里有各种各样的模块你在编译的时候得先添加进去。
tengine开启了dso动态加载模块的支持,你只需要得到模块包 然后使用tengine的编译工具编译进去使用即可。不需要说哪个模块缺少需要整个重新编译了
具体操作如下
我以这个ngx_realtime_request_module 模块为例
git clone https://github.com/magicbear/ngx_realtime_request_module
下载这个包和tengine(自行编译安装)
git clone得到ngx_realtime_request_module 模块文件夹
进入tengine的安装目录下 运行 bin/dso_tool --add-module=/。。(输入模块文件夹的路径)
编译好了编辑conf/nginx.conf
dso {
load ngx_http_realtime_request_module.so;
}
加载这个模块
此时运行nginx -m 查看支持的模块可以看到如下
.........................
ngx_http_realtime_request_module (shared, 3.1) //我们添加的模块已经ok了
ngx_http_copy_filter_module (static)
ngx_http_range_body_filter_module (static)
ngx_http_not_modified_filter_module (static)
...
此时调用即可
server {
listen 80;
server_name localhost;
#access_log logs/host.access.log main;
location /echo {
echo -n "王叶加油" ;
}
location /realtime {
realtime_request on;
}
}
这是楼主配置文件部分
nginx 启动服务 访问
location /realtime {
64 realtime_request on;
65
ok 就这么简单就是不知道这些模块从哪下载 囧 。。我还弄了个echo模块不知道怎么回事不输出 输出让我下载一个二进制的文件,不知道哪错了还忘指正。