Learn about Centmin Mod LEMP Stack today
Register Now

Nginx Nginx -V Progress

Discussion in 'Centmin Mod Insights' started by BamaStangGuy, Jan 24, 2018.

  1. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    8:56 PM
    One of my goals has always been to strip away modules in Nginx that my software does not use. Since I use Wordpress and XenForo, which are pretty simple and lightweight, most of the nginx modules do not provide me any benefit.

    I have gone from:

    Code:
    [00:20][root@xxxxxx-xxx.members.linode.com centminmod]# nginx -V nginx
    version: nginx/1.13.8 built by clang 4.0.1 (tags/RELEASE_401/final)
    built with LibreSSL 2.6.4 TLS SNI support enabled configure arguments:
    --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib'
    --with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3
    -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-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
    -Wno-c++11-compat-deprecated-writable-strings -Wno-write-strings
    -gsplit-dwarf' --sbin-path=/usr/local/sbin/nginx
    --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat
    --with-http_stub_status_module --with-http_gzip_static_module
    --with-http_sub_module --with-http_addition_module --with-threads
    --with-http_realip_module --add-module=../ngx_cache_purge-2.4.2
    --add-dynamic-module=../headers-more-nginx-module-0.33
    --with-pcre=../pcre-8.41 --with-pcre-jit
    --with-zlib=../zlib-cloudflare-1.3.0 --with-http_ssl_module
    --with-http_v2_module --with-openssl=../libressl-2.6.4
    to

    Code:
    [02:25][root@xxxxxx-xxx.members.linode.com centminmod]# nginx -V nginx
    version: nginx/1.13.8 built by gcc 7.2.1 20170829 (Red Hat 7.2.1-1)
    (GCC) built with LibreSSL 2.6.4 TLS SNI support enabled configure
    arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro
    -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m64 -march=native
    -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -flto -fuse-ld=gold
    --param=ssp-buffer-size=4 -Wformat -Werror=format-security
    -Wimplicit-fallthrough=0 -fcode-hoisting -Wp,-D_FORTIFY_SOURCE=2
    -gsplit-dwarf' --sbin-path=/usr/local/sbin/nginx
    --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat
    --with-http_gzip_static_module --with-threads --with-http_realip_module
    --with-pcre=../pcre-8.41 --with-pcre-jit
    --with-zlib=../zlib-cloudflare-1.3.0 --with-http_ssl_module
    --with-http_v2_module --with-openssl=../libressl-2.6.4
    Now I will turn my attention to PHP and see what I can strip there. :)

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,554
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    11:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just note you loose on potential performance too with some of the modules disabled as they're prerequisites for certain nginx setup/configurations for better performance. i.e. cache purge is needed if you have any form of advance level nginx/proxy_cache/fastcgi_cache configuration setup.

    --with-threads to leverage Nginx thread pools can boost Nginx performance 9x fold Nginx - Thread Pools in NGINX Boost Performance 9x!

    stub-status needed for nginx statistics monitoring and some 3rd party monitoring i.e. Nginx Amplify
     
  3. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    8:56 PM
    Understandable. I do not use advanced nginx caching or need the stats monitoring enabled personally. with-threads is enabled still.

    I run simple and straight forward LEMP setup with CloudFlare. Keeps things easy to manage :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,554
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    11:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah each person has their own preferences. 99% of my servers use default Centmin Mod provided nginx modules as I pretty much use all of them including lua nginx for some more advanced features on some of my sites :)
     
  5. buik

    buik “The best traveler is one without a camera.”

    2,001
    519
    113
    Apr 29, 2016
    Flanders
    Ratings:
    +1,651
    Local Time:
    3:56 AM
    If you are running Cloudflare Business there is no need to tweak, strip or anything else with your own Nginx, PHP etc etc.
    Because Cloudflare Business is too influential (the right way).

    If you don't need extra addons or modules.
    It is advisable to use the default configuration.

    Simply because it is the best tested combination and scenario by the Nginx team.
     
  6. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    8:56 PM
    I don't understand? The reason for removing modules that are not needed is to reduce size of nginx. I run CloudFlare business on one site with RailGun and will still see benefit from a smaller nginx footprint.
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,554
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    11:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    If reducing size of nginx binary is goal, then dynamic modules do just that compared to static modules. Of course not as small as having less nginx modules in theory. But the difference isn't that great to begin with compared to implementing configuration tips outlined at Insight Guide - How to boost Centmin Mod LEMP stack performance which can boost performance up to 40-900% (thread pools). Playing with which nginx modules is enabled or not is not going to give anywhere near that type of performance boost ;)
     
  8. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    8:56 PM
    I know but if I am not using them no point in having them in the first place. I have thread pools enabled as well as many of the tweaks you list in that thread :)
     
  9. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    9:56 AM
    Mainline
    10.2
    THis is what I have: