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

nginx源码编辑带第三方模块lua

2015-08-05 11:31 549 查看
系统环境:

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”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  lua;nginx