Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx nginx ngx_pagspeed failed after CMM installation

Discussion in 'Bug Reports' started by JoeDer, Jan 31, 2022.

  1. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.21.6
    • PHP Version Installed: 5.6.40
    • MariaDB MySQL Version Installed: 10.3.x
    • When was last time updated Centmin Mod code base ? : fresh install
    • Persistent Config: /etc/centminmod/custom_config.inc
    Code (Text):
    ENABLEMOTD_CSFMSG='n'
    ENABLEMOTD_LINKSMSG='n'
    DMOTD_PHPCHECK='y'
    LETSENCRYPT_DETECT='y'
    NGXDYNAMIC_BROTLI='y'
    NGINX_LIBBROTLI='y'
    NGXDYNAMIC_FANCYINDEX='y'
    NGINX_FANCYINDEX='y'
    NGINX_PAGESPEEDGITMASTER='n'
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    NGINX_VIDEO='y'
    NGINX_ZERODT='y'
    NGINX_STREAM='y'
    NGINX_STREAMGEOIP='n'
    NGINX_STREAMREALIP='n'
    NGINX_STREAMSSLPREREAD='y'
    NGINX_RTMP='y'
    NGINX_FLV='y'
    NGINX_MP4='y'
    GCC_FALIGN_FUNCTION='y'
    SET_DEFAULT_MYSQLCHARSET='utf8mb4'
    AUTOHARDTUNE_NGINXBACKLOG='y'
    ZSTD_LOGROTATE_NGINX='y'
    ZSTD_LOGROTATE_PHPFPM='y'
    PHP_PGO='y'
    PHP_BROTLI='y'
    PHP_LZFOUR='y'
    PHP_LZF='y'
    PHP_ZSTD='y'
    DUALCERTS='y'
    AUDITD_ENABLE='y'
    VHOSTCTRL_CLOUDFLAREINC='y'
    PHPFINFO_STANDALONE='y'
    LOWMEM_INSTALL='y'
    MARCH_TARGETNATIVE='n'
    

    Tried fresh install 2 times on 2 different servers and at the end nginx seems to not start.
    Code (Text):
    **********************************************************************
    * Starting Services...
    **********************************************************************
    Starting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    [FAILED]
    Redirecting to /bin/systemctl restart postfix.service
    Redirecting to /bin/systemctl start csf.service
    

    Code (Text):
    --------------------------------------------------------
    Check Nginx Version:
    --------------------------------------------------------
    which: no nginx in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
    can not find nginx binary.. install failed
    

    Code (Text):
    # systemctl status nginx.service
    ● nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
       Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since Sun 2022-01-30 21:52:09 UTC; 2min 42s ago
         Docs: man:systemd-sysv-generator(8)
    
    Jan 30 21:52:09 vm.dernikos.gr systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    Jan 30 21:52:09 vm.dernikos.gr systemd[1]: nginx.service: control process exited, code=exited status=5
    Jan 30 21:52:09 vm.dernikos.gr systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    Jan 30 21:52:09 vm.dernikos.gr systemd[1]: Unit nginx.service entered failed state.
    Jan 30 21:52:09 vm.dernikos.gr systemd[1]: nginx.service failed.
    

    Is there any bug or it's something by my installation?

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just did a test run and looks like nginx ngx_pagespeed module isn't compatible with updated GCC 10 compiler

    Code (Text):
    gcc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I/usr/local/zlib-cf/include -I/usr/local/nginx-dep/include -m64 -march=x86-64 -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -flto=4 -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wno-pointer-sign  -Wimplicit-fallthrough=0 -Wno-missing-profile -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-result -Wno-unused-result -fcode-hoisting -Wno-cast-function-type -Wno-format-extra-args -Wno-vla-parameter -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -Wno-deprecated-declarations  -D_GLIBCXX_USE_CXX11_ABI=0 -DNDK_SET_VAR -DNDK_UPSTREAM_LIST --std=c++11 -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../nginx-rtmp-module -I ../ngx_brotli/deps/brotli/c/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/chromium/src -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/google-sparsehash/src/src -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/google-sparsehash/gen/arch/linux/x64/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/grpc/src/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/protobuf/src/src -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/re2/src -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/out/Release/obj/gen -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/out/Release/obj/gen/protoc_out/instaweb -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/apr/src/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/aprutil/src/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/apr/gen/arch/linux/x64/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/aprutil/gen/arch/linux/x64/include -I ../incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/url -I ../ngx_devel_kit-0.3.0/objs -I objs/addon/ndk -I ../ngx_devel_kit-0.3.0/src -I ../ngx_devel_kit-0.3.0/objs -I objs/addon/ndk -I ../openssl-1.1.1m/.openssl/include -I ../zlib-cloudflare-1.3.0 -I objs -I src/http -I src/http/modules -I src/http/v2 -I ../ngx_devel_kit-0.3.0/src -I src/stream \
            -o objs/addon/src/log_message_handler.o \
            ../incubator-pagespeed-ngx-1.13.35.2-stable/src/log_message_handler.cc
    cc1plus: error: command-line option ‘-Wno-pointer-sign’ is valid for C/ObjC but not for C++ [-Werror]
    cc1plus: error: command-line option ‘-Wno-implicit-function-declaration’ is valid for C/ObjC but not for C++ [-Werror]
    cc1plus: error: command-line option ‘-Wno-int-conversion’ is valid for C/ObjC but not for C++ [-Werror]
    cc1plus: note: unrecognized command-line option ‘-Wno-vla-parameter’ may have been intended to silence earlier diagnostics
    cc1plus: all warnings being treated as errors
    make[1]: *** [objs/addon/src/log_message_handler.o] Error 1
    make[1]: Leaving directory `/svr-setup/nginx-1.21.6'
    make: *** [install] Error 2
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Ah actually it's ngx_pagespeed version used by Centmin Mod is older and doesn't support GCC 10. ngx_pagespeed has an RC1 preview release that seems to at least compile Nginx properly. Not sure how it tests though as haven't tested ngx_pagespeed v1.14.33.1-RC1 Releases · apache/incubator-pagespeed-ngx. It's been in RC1 status since August 2020. Though that isn't telling considering how long Centmin Mod 123.09beta01 is labelled beta for LOL

    test main hostname ngx_pagespeed edit nginx vhost /usr/local/nginx/conf/conf.d/virtual.conf and uncomment 3 include lines
    Code (Text):
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    


    then enable ngx_pagespeed
    Code (Text):
    pscontrol on

    check for header
    Code (Text):
    curl -I localhost
    HTTP/1.1 200 OK
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Vary: Accept-Encoding
    Server: nginx centminmod
    X-Powered-By: centminmod
    Date: Mon, 31 Jan 2022 02:01:27 GMT
    X-Page-Speed: 1.14.36.1-0
    Cache-Control: max-age=0, no-cache
    
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    FYI, updated 123.09beta01 with ngx_pagespeed update to 1.14.33.1-RC1 ngx_pagespeed and 1.14.36.1 PSOL/mod-pagespeed versions - so curl header response will report 1.14.36.1.0
    Code (Text):
    curl -I localhost
    HTTP/1.1 200 OK
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Vary: Accept-Encoding
    Server: nginx centminmod
    X-Powered-By: centminmod
    Date: Mon, 31 Jan 2022 02:35:13 GMT
    X-Page-Speed: 1.14.36.1-0
    Cache-Control: max-age=0, no-cache
    

    so run cmupdate command then centmin.sh menu option 4 or start a fresh CentOS 7 + Centmin Mod install and see
     
  6. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
    Unfortunately none of these 2 cases worked :(
    Fresh install:
    Code (Text):
    **********************************************************************
    * Starting Services...
    **********************************************************************
    Starting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    [FAILED]
    Starting mariadb (via systemctl): [ OK ]
    Redirecting to /bin/systemctl restart postfix.service
    Redirecting to /bin/systemctl start csf.service

    Code (Text):
    --------------------------------------------------------
    Check Nginx Version:
    --------------------------------------------------------
    which: no nginx in (/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/opt/rh/devtoolset-10/root/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
    can not find nginx binary.. install failed

    Code (Text):
    # nginx -t
    -bash: nginx: command not found

    Code (Text):
    # cmupdate
    Saved working directory and index state WIP on 123.09beta01: 54080fb update ngx_pagespeed module version in 123.09beta01
    HEAD is now at 54080fb update ngx_pagespeed module version in 123.09beta01
    Already up-to-date.

    Code (Text):
    Enter option [ 1 - 24 ] 4
    --------------------------------------------------------
    **********************************************************************
    * Nginx Update script - Included in Centmin Extras
    * Version: 123.09beta01.b789 - Date: 01/01/22 - Copyright 2011-2022 CentminMod.com
    **********************************************************************
    
    This software comes with no warranty of any kind. You are free to use
    it for both personal and commercial use as licensed under the GPL.
    
    
    Nginx Upgrade - Would you like to continue? [y/n] y
    
    Current Nginx Version: nginx_upgrade.inc: line 554: nginx: command not found
    
    Install which version of Nginx? (version i.e. type 1.21.6): 1.21.6
    
    Do you still want to continue? [y/n] y

    Code (Text):
    Mon Jan 31 18:49:08 UTC 2022
    Error: 2, Nginx make failed
    
    report errors on the forums at community.centminmod.com/forums/8/
    with info asked at community.centminmod.com/threads/17778/

    Code (Text):
    # nginx -t
    -bash: nginx: command not found
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  8. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
    Code (Text):
    # nginx -V
    -bash: nginx: command not found
    

    Code (Text):
    # nginx -t
    -bash: nginx: command not found
    

    CMM install logs
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what does your /etc/centminmod/custom_config.inc persistent config file look like, in the install logs which isn't complete the nginx install part shows Nginx trying to install LibreSSL 3.0.2 instead of normal default OpenSSL 1.1.1m which suggests you have set LIBRESSL_SWITCH='y' in persistent config file. There's no need as OpenSSL 1.1.1 is faster than LibreSSL.

    I haven't tested LibreSSL in ages as it's no longer the recommended crypto library for Nginx as OpenSSL 1.1.1 is best.

    Though the configure section doesn't clearly outline which module/specific is causing nginx failed compile
    Code (Text):
    configuring additional modules
    adding module in ../nginx-rtmp-module
     + ngx_rtmp_module was configured
    adding module in ../ngx_cache_purge-2.5.1
     + ngx_http_cache_purge_module was configured
    adding module in ../redis2-nginx-module-0.15
     + ngx_http_redis2_module was configured
    adding module in ../memc-nginx-module-0.19
     + ngx_http_memc_module was configured
    adding module in ../srcache-nginx-module-0.32
     + ngx_http_srcache_filter_module was configured
    configuring additional dynamic modules
    adding module in ../ngx_brotli
     + ngx_brotli was configured
    adding module in ../
    ./configure: error: no ..//config was found
    
     
  10. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
  11. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Ah I went searching in the code for LIBRESSL_SWITCH='y' and only one condition will force that and it was LOWMEM_INSTALL='y' - this was an ancient decision I made for low memory installs due to OpenSSL compiles using more memory. You have LOWMEM_INSTALL='y' set in persistent config file /etc/centminmod/custom_config.inc which essentially strips all the performance from Centmin Mod installation to prioritize being able to install on a low memory installed system. Any reason why you're setting that flag?

    It will disable Nginx modules below - the check
    Code (Text):
    checkfor_lowmem() {
      if [[ "$LOWMEM_INSTALL" = [yY] ]]; then
        ISLOWMEM='131072'
        CLANG='y'
        CLANG_PHP='n'
        GCCINTEL_PHP='n'
        PHP_PGO='n'
        PHP_PGO_CENTOSSIX='n'
        DEVTOOLSETSIX='n'
        NGINX_DEVTOOLSETGCC='n'
        GENERAL_DEVTOOLSETGCC='n'
        CRYPTO_DEVTOOLSETGCC='n'
        NGINXPATCH='n'
        NGINX_GEOIPMEM='n'           # Nginx caches GEOIP databases in memory (default), setting 'n' caches to disk instead
        NGINX_SECURELINK='n'
        NGINX_FANCYINDEX='n'
        NGINX_VHOSTSTATS='n'
        NGINX_LIBBROTLI='n'
        NGINX_PAGESPEED='n'
        NGINX_HTTPREDIS='n'
        ORESTY_LUANGINX='n'
        PHPFINFO='n'
        PHPMAILPARSE='n'
        LIBRESSL_SWITCH='y'
        PHP_FTPEXT='n'
        NSD_INSTALL='n'
      fi
    }
    

    So it forces disabling of some Nginx modules including ngx_pagespeed so you trying to force it enabled might have just conflicted in ending up with Nginx not finding the modules.

    Probably have to take another look at low memory criteria as with CentOS 7 you'd need at least 1.5-2GB of memory + swap and CentOS 8 you need at least 2.5-3.5GB of memory + swap anyway to run.
     
    Last edited: Feb 1, 2022
  12. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
    Oh didn't know that. I set LOWMEM INSTALL='y' because the VPS has only 1GB of RAM and I thought it would be useful for its performance.

    Can I keep this value and remove from customconfig all the values that are disabled from LOWMEM INSTALL='y' or just remove LOWMEM INSTALL='y' and keep all as it is?
     
  13. eva2000

    eva2000 Administrator Staff Member

    54,906
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just remove LOWMEM_INSTALL='y' - I have actually just updated 123.09beta01 to remove the LOWMEM_INSTALL='y' routine. It was created during CentOS 6 era when CentOS 6 32bit would allow 128-256MB VPS installs. That no longer exists in CentOS 7/8 64bit OS. Centmin Mod initial install will check if you have enough memory to install and let you know anyway. 1GB is bare minimum for basic install, for more performance features and stuff you'd need at least 1.5-2.5GB total for memory + swap disk so you could have 1GB memory and 4GB swap file for 1+4 = 5GB memory though hitting swap will be very very slow for system i.e. compile times.
     
  14. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    2:17 AM
    Nginx 1.21.x
    MariaDB 10.3.x
    Thank you so much :)