openwrt中编译nginx-lua-module模块

背景

    最近在开发高铁CDN项目,由于我们的边缘节点的系统不是标准的centos(而是openwrt),所以在搭建lua-ngx开发环境中就遇到很多问题,最主要的问题是不能直接使用openresty这个平台。为了在nginx 中引入lua,我不得不考虑在ningx中把nginx-lua-module模块编译进来,此外,还需要在openwrt中编译出luajit。这里讲述在openwrt系统中编译nginx-lua-module。


    本文只是粗略记录下,有不懂得可以私信我。

一、系统环境

 

二、编译步骤

1、参数选择和下载第三方模块

nginx 编译:
#修改 auto/cc/name 10行 yes 为 no
#修改 auto/cc/conf 186行 yes 为 no  atomic
#修改 auto/cc/conf 207行 yes 为 no
#修改 auto/cc/conf 221行 yes 为 no
#修改 auto/os/linux 39行 yes 为 no  epoll
#修改 auto/types/sizeof 36行 $CC 为 gcc

下载第三方模块:
#ngx_devel_kit-0.3.1.zip 解压至 /home/huxl/ngx_devel_kit-0.3.1
#lua-nginx-module-0.10.15.zip 解压至 /home/huxl/lua-nginx-module-0.10.15

2、编译ngx-lua-module

source /opt/fsl-qoriq/2.0/environment-setup-aarch64-fsl-linux


编译:
cd /home/huxl/nginx-1.16.1
export DESTDIR="/home/huxl/_install/ngx/"
export CFLAGS="  -O2 -pipe "

export LUAJIT_LIB=/home/huxl/_install/luajit2/usr/local/lib
export LUAJIT_INC=/home/huxl/_install/luajit2/usr/local/include/luajit-2.1

make clean
rm /home/huxl/_install/ngx/* -rf

./configure \
--prefix=/usr/local/nginx \
--user=root --group=root \
--with-pcre \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_mp4_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-pcre-jit \
--add-module=/home/huxl/ngx_devel_kit-0.3.1 \
--add-module=/home/huxl/lua-nginx-module-0.10.15

echo -e "\n#ifndef NGX_SYS_NERR\n#define NGX_SYS_NERR  132\n#endif\n" >> objs/ngx_auto_config.h
echo -e "\n#ifndef NGX_HAVE_MAP_ANON\n#define NGX_HAVE_MAP_ANON  1\n#endif\n" >> objs/ngx_auto_config.h

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值