nginx+lua_module安装

1.LuaJit安装

1 # cd /usr/local/src  
2 # git clone http://luajit.org/git/luajit-2.0.git  
3 # cd luajit-2.0  
4 # make  
5 # make install 

这样luajit就被安装到了/usr/local/ 文件夹下面。

2.ngx_devel_kit

1 # cd /usr/local/src  
2 # git clone https://github.com/simpl/ngx_devel_kit.git  

3.ngx_lua

1 # cd /usr/local/src  
2 # git clone https://github.com/openresty/lua-nginx-module.git 

4.告诉nginx编译器去哪儿找到luajit

1  export LUAJIT_LIB=/usr/local/lib
2  export LUAJIT_INC=/usr/local/include/luajit-2.0

5.编译nginx

1 ./configure --prefix=/usr/local/nginx  
2 --with-ld-opt="-Wl,-E,-rpath,/usr/local/lib" 
3 --add-module=/usr/local/src/ngx_devel_kit  
4 --add-module=/usr/local/src/lua-nginx-module

prefix指出nginx将被安装的目录,这里选择了/usr/local/。

6.make

make install  安装

7.测试

 1 http {  
 2   
 3     server {  
 4           
 5         location /lua_test {  
 6             default_type 'text/plain';  
 7             content_by_lua "ngx.say('Hello, World!')";  
 8         }  
 9     }  
10 } 

 

posted @ 2017-05-18 15:04  SarahLiu77  阅读(213)  评论(0编辑  收藏  举报