nginx平滑升级、在线添加模块(tengine 动态加载模块)


http://www.orzace.com/how-to-upgrade-nginx/


下面是nginx替换成tengine再加上lua 模块,(tengine-2.0.1版本暂时无法动态加载lua模块,只能编译加载)

安装系统所需web软件

1.下载luajit,官网 http://luajit.org/ 
    wget http://luajit.org/download/LuaJIT-2.0.1.tar.gz 
    tar xzvf LuaJIT-2.0.1.tar.gz 
    cd LuaJIT-2.0.1 
     make PREFIX=/usr/local/LuaJIT-2.0.1 
     make install PREFIX=/usr/local/LuaJIT-2.0.1 

2、yum  install  pcre-devel -y


3、/etc/profile

  1. export LUAJIT_LIB=/usr/local/LuaJIT-2.0.1/lib 

  2. export LUAJIT_INC=/usr/local/LuaJIT-2.0.1/include/luajit-2.0 



4、tar xzvf tengine-1.5.2.tar.gz 
    cd tengine-1.5.2 
    ./configure --with-ld-opt="-Wl,-rpath,/usr/local/web/LuaJIT-2.0.1/lib" \ 
    --prefix=/usr/local/tengine  --with-http_lua_module \ 
    --with-luajit-inc=/usr/local/LuaJIT-2.0.1/include/luajit-2.0  
    --with-luajit-lib=/usr/local/LuaJIT-2.0.1/lib 
    make -j2 
    make install -j2 


5、nginx.conf

  1.    location /lua {  

  2.     default_type 'text/plain';  

  3.     content_by_lua 'ngx.say("hello, lua")';  


6、测试

[root@node2 tengine]# curl http://localhost/lua

                     hello, lua

=====================================================================================

  如果是别的模块,只需解压,加载即可

  tar xvf ngx_cache_purge-1.5.tar.gz 

 cd /usr/local/tengine

 sbin/dso_tool --add-module=/root/ngx_cache_purge-1.5

 more /usr/local/tengine/conf/nginx.conf

 dso {

  

     load ngx_http_cache_purge_module.so;   

}

      sbin/nginx -s relaod

       

       sbin/nginx -m 

       ngx_http_cache_purge_module (shared, 3.1)

验正即可

 


你可能感兴趣的:(Export)