tengine 动态加载模块简单上手

首先解释下nginx

nginx里有各类各样的模块你在编译的时候得先添加进去。git

tengine开启了dso动态加载模块的支持,你只须要获得模块包 而后使用tengine的编译工具编译进去使用便可。不须要说哪一个模块缺乏须要整个从新编译了github

具体操做以下c#

我以这个ngx_realtime_request_module 模块为例

git clone https://github.com/magicbear/ngx_realtime_request_module工具

下载这个包和tengine(自行编译安装)code

git clone获得ngx_realtime_request_module 模块文件夹
server

进入tengine的安装目录下 运行 bin/dso_tool --add-module=/。。(输入模块文件夹的路径)get

编译好了编辑conf/nginx.confit

  dso {
  load    ngx_http_realtime_request_module.so;
    }

加载这个模块io

此时运行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模块不知道怎么回事不输出 输出让我下载一个二进制的文件,不知道哪错了还忘指正。

相关文章
相关标签/搜索