Welcome to Centmin Mod Community
Register Now

Nginx How to add nginx module after install centmin

Discussion in 'Install & Upgrades or Pre-Install Questions' started by YuchiRO, Jun 7, 2016.

  1. YuchiRO

    YuchiRO Member

    92
    6
    8
    Jan 12, 2015
    Ratings:
    +8
    Local Time:
    7:12 PM
    5.5.4
    Hi

    Sorry for noob question, how to enable or add module after install centmin ?

    I try to enable mp4 module option on install.sh and select option 4 but nothing ..change.

    btw, "–add-module" is not working with centmin ? I want to add OpenResty Nginx modules and enable mp4 module.
     
  2. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    it's 2 hyphens --add-module

    To enable nginx mp4 module via --with-http_mp4_module, you need to add to persistent config file you have or create it at /etc/centminmod/custom_config.inc and add the variable:
    Code (Text):
    NGINX_MP4='y'

    then recompile nginx via centmin.sh menu option 4 and then check the configure options via command
    Code (Text):
    nginx -V

    If you need to custom add additional modules not supported by Centmin Mod Nginx read below. But first check with Centmin Mod 123.09beta01 as it has added variable support for other Nginx modules similar to above MP4 module via NGINX_MP4 that you can enable and recompile Nginx with. 123.09beta01 change log and centmin.sh list of variables you can place in the persistent config file at /etc/centminmod/custom_config.inc.

    I posted an example of how to add nginx modules to Centmin Mod at centminmod.com/nginx_webdav.html for webdav prior to it becoming an official part of Centmin Mod's default module list. You can use that example to pretty much add or extend Nginx with additional modules.

    Only limitations are
    1. You need to know generally how to add Nginx modules and that is basically the same for any Nginx server not just Centmin Mod
    2. You also need to know the instructions for specific Nginx module
    3. You also need to know any prerequiste system dependencies and YUM packages that the Nginx module requires as I may not know what they are as I may have never used the Nginx module you want.
    4. I'm limited to what I can add to Centmin Mod by what I know and use usually and what I am comfortable with supporting. So that limits what officially I can add to Centmin Mod. But you are free to add whatever you need using above as a guide.
    For Centmin Mod Nginx, download tar.gz nginx modules to /svr-setup and extract and then editing inc/nginx_configure.inc just use the same --add-module=../nginx-module-name line.

    Posted a more recent example below. Actual Github commits for adding 3 new Centmin Mod Nginx modules, echo-nginx-module, set-misc-nginx-module and ngx_devel_kit are located below (you can use these changes and webdav example as a blue print for understanding how to extend and add your own Centmin Mod Nginx modules.

    Github commits for 3 new Nginx modules

    General Info on Adding New Nginx Modules



    There's 5 basic steps involve in adding a new Nginx module into Centmin Mod Nginx server for Centmin Mod .08 beta02 and higher. They involve editing 5 Centmin Mod files.
    1. centmin.sh - add VARIABLE name to define the nginx module's version number if there is one
    2. inc/downloadlinks.inc - add 2 VARIABLES to define the module download link and filename
    3. inc/downloads.inc - add download function to download the module using download link defined in inc/downloadlinks.inc and test the download validity i.e. untar it using filename defined in inc/downloadlinks.inc
    4. inc/nginx_configure.inc - add check variables to grab latest nginx module extracted directory and put it info directory variable to be called from Nginx ./configure options only if NGINX_OPENRESTY='y'
    5. inc/nginx_upgrade.inc - add to existing file check, the new module download file name (defined in inc/downloadlinks.inc). This ensures, when you run centmin.sh menu option 4 to upgrade Nginx, if the new nginx module download file doesn't exist in /svr-setup, it will download it and extract it before the Nginx compilation begins
    Another way of doing it is shown at Nginx - A straight forward tutorial to install test-cookie? | Centmin Mod Community This way doesn't allow for managing nginx module version updates and auto updates via centmin.sh menu option 4 like the above method.

    The above is for nginx modules requiring additional downloads to be configured. There's also nginx modules which do not need additional downloads but just enabling of the nginx module itself. I just added ngx_http_auth_request_module to Nginx for .08 beta 03 as it only required adding --with-http_auth_request_module to configure options. You can see the changes I did here add ngx_http_auth_request_module support · centminmod/centminmod@ec079c5 · GitHub - similar to above instructions just did not need to touch inc/downloadslinks.inc and inc/downloads.inc and inc/nginx_upgrade.inc as there are NO additional downloads to account for and check.
     
  3. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    centmin mod 123.09beta01 already has alot of openresty nginx modules added via NGINX_OPENRESTY='y' in centmin.sh as well

    list of variables and versions for openresty nginx modules when NGINX_OPENRESTY='y and ORESTY_LUANGINX='y' (disabled by default) are set and nginx recompiled via centmin.sh menu option 4
    Code (Text):
    grep ^ORESTY centmin.sh
    ORESTY_HEADERSMORE='y'       # openresty headers more https://github.com/openresty/headers-more-nginx-module
    ORESTY_HEADERSMOREGIT='n'    # use git master instead of version specific
    ORESTY_MEMCVER='0.17'        # openresty memc module https://github.com/openresty/memc-nginx-module
    ORESTY_SRCCACHEVER='0.31'    # openresty subrequest cache module https://github.com/openresty/srcache-nginx-module
    ORESTY_DEVELKITVER='0.3.0'  # openresty ngx_devel_kit module https://github.com/simpl/ngx_devel_kit
    ORESTY_SETMISCGIT='n'        # use git master instead of version specific
    ORESTY_SETMISCVER='0.30'     # openresty set-misc-nginx module https://github.com/openresty/set-misc-nginx-module
    ORESTY_ECHOGIT='n'           # use git master instead of version specific
    ORESTY_ECHOVER='0.59'     # openresty set-misc-nginx module https://github.com/openresty/echo-nginx-module
    ORESTY_REDISVER='0.13'       # openresty redis2-nginx-module https://github.com/openresty/redis2-nginx-module
    ORESTY_LUANGINX='n'             # enable or disable or ORESTY_LUA* nginx modules below
    ORESTY_LUANGINXVER='0.10.5'     # openresty lua-nginx-module https://github.com/openresty/lua-nginx-module
    ORESTY_LUAGITVER='2.0.4'        # luagit http://luajit.org/
    ORESTY_LUAMEMCACHEDVER='0.14'   # openresty https://github.com/openresty/lua-resty-memcached
    ORESTY_LUAMYSQLVER='0.16'       # openresty https://github.com/openresty/lua-resty-mysql
    ORESTY_LUAREDISVER='0.24'       # openresty https://github.com/openresty/lua-resty-redis
    ORESTY_LUADNSVER='0.14'         # openresty https://github.com/openresty/lua-resty-dns
    ORESTY_LUAUPLOADVER='0.09'      # openresty https://github.com/openresty/lua-resty-upload
    ORESTY_LUAWEBSOCKETVER='0.05'   # openresty https://github.com/openresty/lua-resty-websocket
    ORESTY_LUALOCKVER='0.04'        # openresty https://github.com/openresty/lua-resty-lock
    ORESTY_LUASTRINGVER='0.09'      # openresty https://github.com/openresty/lua-resty-string
    ORESTY_LUAREDISPARSERVER='0.10'    # openresty https://github.com/openresty/lua-redis-parser
    ORESTY_LUAUPSTREAMCHECKVER='0.04'  # openresty https://github.com/openresty/lua-resty-upstream-healthcheck
    ORESTY_LUALRUCACHEVER='0.04'       # openresty https://github.com/openresty/lua-resty-lrucache
    ORESTY_LUARESTYCOREVER='0.1.6'     # openresty https://github.com/openresty/lua-resty-core
    ORESTY_LUAUPSTREAMVER='0.05'       # openresty https://github.com/openresty/lua-upstream-nginx-module
    ORESTY_LUALOGGERSOCKETVER='0.1'    # cloudflare openresty https://github.com/cloudflare/lua-resty-logger-socket
    ORESTY_LUACOOKIEVER='master'       # cloudflare openresty https://github.com/cloudflare/lua-resty-cookie
    ORESTY_LUAUPSTREAMCACHEVER='0.1.1' # cloudflare openresty https://github.com/cloudflare/lua-upstream-cache-nginx-module
     
  4. YuchiRO

    YuchiRO Member

    92
    6
    8
    Jan 12, 2015
    Ratings:
    +8
    Local Time:
    7:12 PM
    5.5.4
    I follow your help but nothing change.
    1. create file custom_config.inc at /etc/centminmod/
    2. select option 4, select Y to upgrade, select version 1.11.1


    [root@localhost ~]# nginx -V
    nginx version: nginx/1.11.1
    built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
    built with LibreSSL 2.3.4
    TLS SNI support enabled
    configure arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module --with-http_secure_link_module --with-http_realip_module --with-http_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../nginx-accesskey-2.0.3 --add-module=../nginx-http-concat-master --add-module=../memc-nginx-module-0.17 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_devel_kit-0.3.0 --add-module=../set-misc-nginx-module-0.30 --add-module=../echo-nginx-module-0.59 --add-module=../redis2-nginx-module-0.13 --add-module=../ngx_http_redis-0.3.7 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-module-vts --add-module=../headers-more-nginx-module-0.30 --with-openssl=../libressl-2.3.4 --with-libatomic --with-pcre=../pcre-8.38 --with-pcre-jit
    [root@localhost ~]#
     
  5. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    you using 123.08stable ? try with centmin mod 123.09beta01

    otherwise you need to look into nginx upgrade log

    To troubleshoot, you need to check the the nginx upgrade log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the initial install log. You can see full details at How to troubleshoot Centmin Mod initial install issues

    also what's output of
    Code (Text):
    nginx -t

    when you run centmin.sh menu option 4 there's a nginx upgrade log timestamped at /root/centminlogs

    if you type this command it lists all logs in date ascending order so latest log at bottom
    Code (Text):
    ls -lArt /root/centminlogs

    so copy the entire contents of latest nginx_upgrade log to gist.github.com or pastebin.com
     
  6. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    also only launch centmin.sh menu option 4 after custom_config.inc is in place and not after or during centmin.sh launched as centmin.sh won't be able to detect it if you do it after or during launch
     
  7. YuchiRO

    YuchiRO Member

    92
    6
    8
    Jan 12, 2015
    Ratings:
    +8
    Local Time:
    7:12 PM
    5.5.4
  8. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
  9. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    nginx failed to properly compile with errors
    Code (Text):
    make[2]: Entering directory `/svr-setup/libressl-2.3.4'
    CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /svr-setup/libressl-2.3.4/missing aclocal-1.15 -I m4
    /svr-setup/libressl-2.3.4/missing: line 81: aclocal-1.15: command not found
    WARNING: 'aclocal-1.15' is missing on your system.
             You should only need it if you modified 'acinclude.m4' or
             'configure.ac' or m4 files included by 'configure.ac'.
             The 'aclocal' program is part of the GNU Automake package:
             <http://www.gnu.org/software/automake>
             It also requires GNU Autoconf, GNU m4 and Perl in order to run:
             <http://www.gnu.org/software/autoconf>
             <http://www.gnu.org/software/m4/>
             <http://www.perl.org/>
    make[2]: *** [aclocal.m4] Error 127
    make[2]: Leaving directory `/svr-setup/libressl-2.3.4'
    make[1]: *** [../libressl-2.3.4/.openssl/include/openssl/ssl.h] Error 2
    make[1]: *** Waiting for unfinished jobs....
    make[2]: Entering directory `/svr-setup/pcre-8.38'
    CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /svr-setup/pcre-8.38/missing aclocal-1.15 -I m4
    /svr-setup/pcre-8.38/missing: line 81: aclocal-1.15: command not found
    WARNING: 'aclocal-1.15' is missing on your system.
             You should only need it if you modified 'acinclude.m4' or
             'configure.ac' or m4 files included by 'configure.ac'.
             The 'aclocal' program is part of the GNU Automake package:
             <http://www.gnu.org/software/automake>
             It also requires GNU Autoconf, GNU m4 and Perl in order to run:
             <http://www.gnu.org/software/autoconf>
             <http://www.gnu.org/software/m4/>
             <http://www.perl.org/>
    make[2]: *** [aclocal.m4] Error 127
    make[2]: Leaving directory `/svr-setup/pcre-8.38'
    make[1]: *** [../pcre-8.38/Makefile] Error 2
    make[1]: Leaving directory `/svr-setup/nginx-1.11.1'
    make: *** [build] Error 2
    
    real    0m0.333s
    user    0m0.061s
    sys    0m0.045s
     
  10. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    libressl 2.3.5 is latest so what you can do is update to latest 123.08stable or 123.09beta01 via centmin.sh menu option 23 submenu option 2, exit centmin.sh and re-run centmin.sh menu option 4 to recompile nginx again
     
  11. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    also what is output for these 2 commands
    Code (Text):
    yum -q list automake
    rpm -ql automake
     
  12. YuchiRO

    YuchiRO Member

    92
    6
    8
    Jan 12, 2015
    Ratings:
    +8
    Local Time:
    7:12 PM
    5.5.4
    After update to 123.09beta01 i see mp4 module enable :)

    Thanks your help :)
     
    • Like Like x 1
  13. eva2000

    eva2000 Administrator Staff Member

    29,023
    6,586
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,776
    Local Time:
    10:12 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1