nginx源碼編輯帶第三方模塊lua

系統環境:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:        12.04
Codename:       precise

下載nginx_lua_module

下載ngx_devel_kit

安裝 luajit
apt-get install libluajit-5.1-dev luajit


 ls /opt/nginx_comp
 lua-nginx-module-0.9.16         nginx-1.2.7-no_buffer-v6.patch  nginx_upload_module-2.2.0.tar.gz         ngx_devel_kit-0.2.19         pcre-8.34.zip
lua-nginx-module-0.9.16.tar.gz  nginx-1.2.7.tar.gz              nginx-upload-progress-module-master      ngx_devel_kit-0.2.19.tar.gz  php-5.5.7
nginx-1.2.7                     nginx_upload_module-2.2.0       nginx-upload-progress-module-master.zip  pcre-8.34                    php-5.5.7.tar.gz 
 cd /opt/nginx_comp/nginx-1.2.7/
 ./configure --user=www-data --group=www-data --prefix=/usr/local/nginx-1.2.7/ --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module  --with-http_gzip_static_module --with-http_mp4_module --add-module=../ngx_devel_kit-0.2.19   --add-module=../lua-nginx-module-0.9.16 
 
vi  objs/Makefile 

CFLAGS =   -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -DNDK_SET_VAR
CFLAGS =   -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g -DNDK_SET_VAR

make -j4
make install

測試是否成功:

nginxconfig中加入

 

location /hello {    
      default_type 'text/plain';    
      content_by_lua 'ngx.say("hello, lua")';    
}



訪問192.168.100.1/hello

會出現“hello,lua”


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章