二.动态模块加载(DSO)支持

来源:互联网 发布:战舰世界征服者数据 编辑:程序博客网 时间:2024/05/29 04:36
1.描述:
    这个模块主要是用来运行时动态加载模块,而不用每次都要重新编译Tengine.
    如果你想要编译官方模块为动态模块,你需要在configure的时候加上类似这样的指令(--with-http_xxx_module),./configure --help可以看到更多的细节.
    如果只想要安装官方模块为动态模块(不安装Nginx),那么就只需要configure之后,执行 make dso_install命令.
    动态加载模块的个数限制为128个.
    如果已经加载的动态模块有修改,那么必须重起Tengine才会生效.
    只支持HTTP模块.
    模块 在Linux/FreeeBSD/MacOS下测试成功.


2.进入源码目录
  $ cd /home/jihuan/tengine-2.0.3
  $ ./configure --prefix=/usr/local/tengine --with-http_trim_filter_module=shared
  $ make
  $ make dso_install
  安装完之后在/usr/local/tengine/modules里有ngx_http_trim_filter_module.so文件。


3.编辑配置文件
  $ vi /usr/local/tengine/conf/nginx.conf
  dso {
     load ngx_http_trim_filter_module.so;
  }


4.编译第三方模块
  你能够使用dso_tool(在Nginx安装目录的sbin下)这个工具来编译第三方模块.
  例子:
      $ cd /usr/local/tengine/sbin
      $ ./dso_tool --add-module=/home/dso/lua-nginx-module
      将会编译ngx_lua模块为动态库,然后安装到默认的模块路径.如果你想要安装到指定位置
      那么需要指定--dst选项(更多的选项请使用dso_tool -h查看).
0 0