常见的nginx扩展模块安装

kevin.Zhu 发布于:2013-3-12 14:14 分类:Nginx  有 20 人浏览,获得评论 0 条  

http://blog.csdn.net/qinyushuang/article/details/43955249



1.安装drizzle1.0:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget http://agentzh.org/misc/nginx/drizzle7-2011.07.21.tar.gz  
  2. cd drizzle7-2011.07.21/  
  3. ./configure --without-server   
  4. make libdrizzle-1.0  
  5. make install-libdrizzle-1.0  
修改/etc/profile,新增以下两行,或者直接执行下面两句
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. export LIBDRIZZLE_INC=/usr/local/include/libdrizzle-1.0  
  2. export LIBDRIZZLE_LIB=/usr/local/lib  

2.下载并解压rds-json-nginx-module
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/openresty/rds-json-nginx-module/archive/v0.13.tar.gz  
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. tar -zxvf v0.13.tar.gz  

3.下载并解压drizzle-nginx-module
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/openresty/drizzle-nginx-module/archive/master.zip  
  2. unzip master.zip  
  3. mv master.zip drizzle-nginx-module-master.zip  
  4. mv drizzle-nginx-module-master drizzle-nginx-module   

4. 下载并解压redis2-nginx-module
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/openresty/redis2-nginx-module/archive/master.zip  
  2. unzip master.zip  
  3. mv master.zip redis2-nginx-module-master.zip  
  4. mv redis2-nginx-module-master redis2-nginx-module  

下载并解压set-misc-nginx-module(unknown directive "set_unescape_uri")
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/openresty/set-misc-nginx-module/archive/v0.28.tar.gz  
  2. tar -zxvf v0.28.tar.gz  

下载编译form-input-nginx-module

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/calio/form-input-nginx-module/archive/master.zip  
  2. mv master.zip form-input-nginx-module-master.zip  
  3. unzip form-input-nginx-module-master.zip  
  4. mv form-input-nginx-module-master form-input-nginx-module  

下载并编译lua-cjson( module 'cjson' not found)
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz    
  2. tar -zxvf lua-cjson-2.1.0.tar.gz  
  3. cd lua-cjson-2.1.0  
修改当前目录下的Makefile,将LUA_INCLUDE_DIR值赋值为 $(PREFIX)/include/luajit-2.0
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. make  
  2. make install  

下载并编译lua-redis-parser-0.10.tar.gz(module 'redis.parser' not found

这个是lua的一个扩展,完成下叙述的安装后会在/usr/local/lib/lua/5.1/redis/生成一个parser.so文件。提供供lua调用的方法,用于解析从redis返回的数据

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. wget https://github.com/openresty/lua-redis-parser/archive/master.zip  
  2. mv master.zip lua-redis-parser-master.zip  
  3. unzip lua-redis-parser-master.zip   
  4. cd lua-redis-parser-master  

修改当前目录下的Makefile,将LUA_INCLUDE_DIR值赋值为 $(PREFIX)/include/luajit-2.0
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. make && make install  

4.重新编译nginx
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. cd /data0/source_code/nginx-1.4.2    
  2.   
  3. ./configure  --user=www --group=www --prefix=/data0/nginx-1.4.2 --with-http_stub_status_module --with-pcre=/data0/source_code/pcre-8.33/ --add-module=/data0/source_code/ngx_devel_kit-0.2.18  --add-module=/data0/source_code/echo-nginx-module-0.57 --add-module=/data0/source_code/lua-nginx-module-0.8.6  --add-module=/data0/source_code/rds-json-nginx-module-0.13 --add-module=/data0/source_code/drizzle-nginx-module --add-module=/data0/source_code/redis2-nginx-module --add-module=/data0/source_code/set-misc-nginx-module-0.28 --with-debug  
  4.   
  5. make -j2  
  6.   
  7. make install  

注意上述步骤中./configure 后有个参数是--with-debug,加上这个参数便于后期调试。




	

完成后可以在当前目录下执行objs/nginx -V 看看是否所有该装的module都装上了,如下:

objs/nginx -V