nginx安装支持ssl和lua
安装LuaJIT
wget -c http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar xzvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make install PREFIX=/usr/local/luajit
修改/etc/profile文件,在最后添加
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
运行source /etc/profile 使环境变量生效
下载NDK
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xzvf v0.3.0.tar.gz
官方说明文档:
If another Nginx module you wish to use specifies that the NDK is a dependency, you will need to do the following :
download the source (https://github.com/simpl/ngx_devel_kit)
unpack the source (tar -xzf $name)
compile Nginx with the following extra option --add-module=/path/to/ngx_devel_kit.
e.g.
./configure --add-module=/path/to/ngx_devel_kit \
--add-module=/path/to/another/module
安装lua-nginx模块
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.11.tar.gz
tar -xzvf v0.10.11.tar.gz
安装/升级nginx
wget https://nginx.org/download/nginx-1.13.8.tar.gz
tar -xzvf nginx-1.13.8.tar.gz
./configure --with-http_ssl_module --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" --add-module=/usr/local/ngx-devel-kit-0.3.0 --add-module=/usr/local/lua-nginx-module-0.10.11
(注意红色字体部分,否则会出现 error: ngx_http_lua_module requires the Lua library 错误,如果还是出现这个错误重启系统后再执行configure)
make -j2
make install
以下是升级nginx时使用:
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
cp nginx /usr/local/nginx/sbin/
make upgrade