Ubuntu 下编译带 Lua 插件的 Nginx

安装 Libgd

sudo apt-get install -y libgd-dev

安装 lua & luajit

sudo apt install -y lua5.1 liblua5.1-0-dev luajit libluajit-5.1-dev

环境变量设置

export LUAJIT_LIB=/usr/lib/x86_64-linux-gnu
export LUAJIT_INC=/usr/include/luajit-2.0

clone 最新版 lua_ngx

git clone https://github.com/openresty/lua-nginx-module.git

下载 Nginx 1.11.x

wget http://nginx.org/download/nginx-1.11.13.tar.gz
tar -xzf nginx-1.11.13.tar.gz
cd nginx-1.11.13/

以下版本在 Ubuntu 18.04 也可以通过编译: 1.13.8

配置编译Nginx


./configure --user=ubuntu --group=ubuntu \
--prefix=/usr/local/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_image_filter_module \
--with-ld-opt="-Wl,-rpath,/usr/lib/x86_64-linux-gnu" \
--add-module=../lua-nginx-module
make -j2
make install

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.