您的位置:首页 > 运维架构 > Nginx

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

2014-08-22 10:29 573 查看
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/profileexport LUAJIT_LIB=/usr/local/LuaJIT-2.0.1/lib

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

location /lua {

default_type 'text/plain';

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