diff --git a/compile.sh b/compile.sh index 6ba5e69..bcd8971 100644 --- a/compile.sh +++ b/compile.sh @@ -1,6 +1,6 @@ #!/bin/sh -NTASK=$(($(nproc)*2)) +NTASK=$(nproc) # install build dependencies apk add --no-cache --virtual build autoconf libtool automake git geoip-dev yajl-dev g++ curl-dev libxml2-dev pcre-dev make linux-headers libmaxminddb-dev @@ -27,13 +27,35 @@ git clone https://github.com/leev/ngx_http_geoip2_module.git # cookie git clone https://github.com/AirisX/nginx_cookie_flag_module.git +# LUA requirements +git clone https://github.com/openresty/luajit2.git +cd luajit2 +make -j $NTASK +make install +cd /tmp +git clone https://github.com/openresty/lua-resty-core.git +cd lua-resty-core +make install +cd /tmp +git clone https://github.com/openresty/lua-resty-lrucache.git +cd lua-resty-lrucache +make install +cd /tmp +git clone https://github.com/openresty/lua-resty-dns.git +cd lua-resty-dns +make install +cd /tmp +git clone https://github.com/openresty/lua-nginx-module.git +export LUAJIT_LIB=/usr/local/lib +export LUAJIT_INC=/usr/local/include/luajit-2.1 + # compile and install nginx cd /tmp VERSION="1.18.0" wget https://nginx.org/download/nginx-${VERSION}.tar.gz tar -xvzf nginx-${VERSION}.tar.gz cd nginx-${VERSION} -./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx/nginx.pid --modules-path=/usr/lib/nginx/modules --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --add-module=/tmp/ModSecurity-nginx --add-module=/tmp/headers-more-nginx-module --add-module=/tmp/ngx_http_geoip2_module --add-module=/tmp/nginx_cookie_flag_module +./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx/nginx.pid --modules-path=/usr/lib/nginx/modules --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --add-module=/tmp/ModSecurity-nginx --add-module=/tmp/headers-more-nginx-module --add-module=/tmp/ngx_http_geoip2_module --add-module=/tmp/nginx_cookie_flag_module --add-module=/tmp/lua-nginx-module make -j $NTASK make install strip /usr/sbin/nginx diff --git a/confs/nginx.conf b/confs/nginx.conf index 0c388f4..92d1168 100644 --- a/confs/nginx.conf +++ b/confs/nginx.conf @@ -65,6 +65,10 @@ http { access_log syslog:server=unix:/dev/log,nohostname,facility=local0 combined; error_log syslog:server=unix:/dev/log,nohostname,facility=local0,severity=warn; + # lua path + lua_package_path "/usr/local/lib/lua/?.lua;;"; + # lua_shared_dict somecache 10m; + # server config include /etc/nginx/server.conf;