From c1917491819525d6c40ae3946945869ce12ca4bf Mon Sep 17 00:00:00 2001 From: George Liu Date: Thu, 11 Feb 2016 20:31:03 +1000 Subject: [PATCH] update inc/nginx_configure.inc Add additional 3rd party dynamic module routines for supporting Openresty headersmore, setmisc, echo and nginx lua modules. Also added individual switches for each along with the existing nginx imagefilter, geoip and stream dynamic modules. These switches allow you to individually choose if you want those nginx modules to be compiled as dynamic modules or statically as previously done In centmin.sh, the 3 default official nginx dynamic modules are enabled by default, why the Openresty ones are disabled as currently their support is only in their respective master branches and not in current respective released versions [CODE] # Nginx Dynamic Module Switches NGXDYNAMIC_IMAGEFILTER=y NGXDYNAMIC_GEOIP=y NGXDYNAMIC_STREAM=y NGXDYNAMIC_HEADERSMORE=n NGXDYNAMIC_SETMISC=n NGXDYNAMIC_ECHO=n NGXDYNAMIC_LUA=n [/CODE] --- centmin.sh | 9 ++++++ inc/nginx_configure.inc | 71 +++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/centmin.sh b/centmin.sh index 70c06b78a..fd59836dd 100755 --- a/centmin.sh +++ b/centmin.sh @@ -286,6 +286,15 @@ PHP_DISABLED=n # when set to =y, PHP-FPM disabled by default wit MYSQLSERVICE_DISABLED=n # when set to =y, MariaDB MySQL service disabled by default with chkconfig off PUREFTPD_DISABLED=n # when set to =y, Pure-ftpd service disabled by default with chkconfig off +# Nginx Dynamic Module Switches +NGXDYNAMIC_IMAGEFILTER=y +NGXDYNAMIC_GEOIP=y +NGXDYNAMIC_STREAM=y +NGXDYNAMIC_HEADERSMORE=n +NGXDYNAMIC_SETMISC=n +NGXDYNAMIC_ECHO=n +NGXDYNAMIC_LUA=n + # General Configuration NGINXUPGRADESLEEP='3' NSD_INSTALL=y # Install NSD (DNS Server) diff --git a/inc/nginx_configure.inc b/inc/nginx_configure.inc index 4bd25ee80..89c628405 100644 --- a/inc/nginx_configure.inc +++ b/inc/nginx_configure.inc @@ -176,7 +176,7 @@ if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$ fi if [[ "$NGINX_IMAGEFILTER" = [yY] ]]; then - if [[ "$DYNAMIC_SUPPORT" = [yY] ]]; then + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_IMAGEFILTER" = [yY] ]]; then IMAGEFILTEROPT=" --with-http_image_filter_module=dynamic" if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then echo "load_module \"modules/ngx_http_image_filter_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf @@ -207,7 +207,16 @@ if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$ fi if [[ "$ORESTY_HEADERSMORE" = [yY] ]]; then - HEADERSMOREOPT=" --add-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + # nginx 1.9.11+ dynamic module support + # https://github.com/openresty/headers-more-nginx-module#installation + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_HEADERSMORE" = [yY] ]]; then + HEADERSMOREOPT=" --add-dynamic-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then + echo "load_module \"modules/ngx_http_headers_more_filter_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf + fi + else + HEADERSMOREOPT=" --add-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + fi else HEADERSMOREOPT="" fi @@ -251,9 +260,31 @@ if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$ REDISDIR=`ls -rt $DIR_TMP | grep redis2-nginx-module | egrep -v 'gz|zip' | tail -1` MEMCOPT=" --add-module=../${MEMCDIR}" SRCCACHEOPT=" --add-module=../${SRCACHEDIR}" - SETMISCOPT=" --add-module=../${SETMISCDIR}" + + # nginx 1.9.11+ dynamic module support + # https://github.com/openresty/set-misc-nginx-module#installation + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_SETMISC" = [yY] ]]; then + SETMISCOPT=" --add-dynamic-module=../${SETMISCDIR}" + if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then + echo "load_module \"modules/ngx_http_set_misc_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf + fi + else + SETMISCOPT=" --add-module=../${SETMISCDIR}" + fi + DEVELKITOPT=" --add-module=../${DEVELKITDIR}" - ECHOOPT=" --add-module=../${ECHODIR}" + + # nginx 1.9.11+ dynamic module support + # https://github.com/openresty/echo-nginx-module#installation + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_ECHO" = [yY] ]]; then + ECHOOPT=" --add-dynamic-module=../${ECHODIR}" + if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then + echo "load_module \"modules/ngx_http_echo_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf + fi + else + ECHOOPT=" --add-module=../${ECHODIR}" + fi + REDISOPT=" --add-module=../${REDISDIR}" else MEMCOPT="" @@ -266,7 +297,18 @@ if [[ "$CENTOSVER" = '6.0' || "$CENTOSVER" = '6.1' || "$CENTOSVER" = '6.2' || "$ if [[ "$ORESTY_LUANGINX" = [yY] ]]; then luapatch - LUAOPT=" --add-module=../lua-nginx-module-${ORESTY_LUANGINXVER} --add-module=../lua-upstream-nginx-module-${ORESTY_LUAUPSTREAMVER} --add-module=../lua-upstream-cache-nginx-module-${ORESTY_LUAUPSTREAMCACHEVER}" + + # nginx 1.9.11+ dynamic module support + # https://github.com/openresty/echo-nginx-module#installation + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_LUA" = [yY] ]]; then + LUAOPT=" --add-dynamic-module=../lua-nginx-module-${ORESTY_LUANGINXVER} --add-module=../lua-upstream-nginx-module-${ORESTY_LUAUPSTREAMVER} --add-module=../lua-upstream-cache-nginx-module-${ORESTY_LUAUPSTREAMCACHEVER}" + if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then + echo "load_module \"modules/ngx_http_lua_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf + fi + else + LUAOPT=" --add-module=../lua-nginx-module-${ORESTY_LUANGINXVER} --add-module=../lua-upstream-nginx-module-${ORESTY_LUAUPSTREAMVER} --add-module=../lua-upstream-cache-nginx-module-${ORESTY_LUAUPSTREAMCACHEVER}" + fi + LUALD_OPT=" -Wl,-rpath,$LUAJIT_LIB" if [[ ! -f /usr/bin/lua || ! -f /usr/include/lua.h ]]; then yum -q -y install lua lua-devel @@ -516,7 +558,7 @@ else fi if [[ "$NGINX_IMAGEFILTER" = [yY] ]]; then - if [[ "$DYNAMIC_SUPPORT" = [yY] ]]; then + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_IMAGEFILTER" = [yY] ]]; then IMAGEFILTEROPT=" --with-http_image_filter_module=dynamic" if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then echo "load_module \"modules/ngx_http_image_filter_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf @@ -547,7 +589,16 @@ else fi if [[ "$ORESTY_HEADERSMORE" = [yY] ]]; then - HEADERSMOREOPT=" --add-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + # nginx 1.9.11+ dynamic module support + # https://github.com/openresty/headers-more-nginx-module#installation + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_HEADERSMORE" = [yY] ]]; then + HEADERSMOREOPT=" --add-dynamic-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then + echo "load_module \"modules/ngx_http_headers_more_filter_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf + fi + else + HEADERSMOREOPT=" --add-module=../headers-more-nginx-module-${NGINX_HEADERSMORE}" + fi else HEADERSMOREOPT="" fi @@ -668,7 +719,7 @@ if [[ "$NGINX_GEOIP" = [yY] ]]; then if [[ ! -d /usr/share/GeoIP ]]; then geoipinstall fi - if [[ "$DYNAMIC_SUPPORT" = [yY] ]]; then + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_GEOIP" = [yY] ]]; then GEOIPOPT=' --with-http_geoip_module=dynamic' if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then echo "load_module \"modules/ngx_http_geoip_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf @@ -755,7 +806,7 @@ NGXINSTALL_VER=$(echo $NGINX_VERSION | cut -d . -f1,2) NGXUPGRADE_VER=$(echo $ngver | cut -d . -f1,2) if [[ "$ngver" && "$NGXUPGRADE_VER" = '1.9' ]]; then if [[ "$NGINX_STREAM" = [yY] ]]; then - if [[ "$DYNAMIC_SUPPORT" = [yY] ]]; then + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_STREAM" = [yY] ]]; then STREAM=' --with-stream=dynamic --with-stream_ssl_module' if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then echo "load_module \"modules/ngx_stream_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf @@ -778,7 +829,7 @@ if [[ "$ngver" && "$NGXUPGRADE_VER" = '1.9' ]]; then # sed -i.bak 's|ngx_http_set_connection_log|ngx_set_connection_log|g' ${DIR_TMP}/lua-nginx-module-${ORESTY_LUANGINXVER}/src/ngx_http_lua_timer.c elif [[ -z "$ngver" && "$NGXINSTALL_VER" = '1.9' ]]; then if [[ "$NGINX_STREAM" = [yY] ]]; then - if [[ "$DYNAMIC_SUPPORT" = [yY] ]]; then + if [[ "$DYNAMIC_SUPPORT" = [yY] && "$NGXDYNAMIC_STREAM" = [yY] ]]; then STREAM=' --with-stream=dynamic --with-stream_ssl_module' if [ -f /usr/local/nginx/conf/dynamic-modules.conf ]; then echo "load_module \"modules/ngx_stream_module.so\";" >> /usr/local/nginx/conf/dynamic-modules.conf