Learn about Centmin Mod LEMP Stack today
Register Now

Nginx PageSpeed PageSpeed Issues

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by RB1, Nov 29, 2016.

  1. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    8:06 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Hi again :(

    I'm writing because I haven't really had any issues with Nginx Pagespeed since setting my server up, but after updating Nginx to 1.11.6, the Nginx service is unable to start.
    Code (Text):
    Restarting 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.

    "nginx -t" returns:
    Code (Text):
    nginx: [emerg] unknown directive "pagespeed" in /usr/local/nginx/conf/pagespeedadmin.conf:9
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

    I have tried downgrading Nginx to 1.11.5 (last version working with Pagespeed) but it didn't fix the problem. I also set persistent config NGINX_PAGESPEED='n' and re-compiled and I'm still getting the same error with PageSpeed disabled.

    The only thing that has allowed my Nginx service to actually start is by commenting out "include /usr/local/nginx/conf/pagespeedadmin.conf;" but then PageSpeed won't work :(

    Is my server totally messed up now?

     
  2. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    What version of centmin mod used 123.08stable or 123.09beta01 ?

    FYI, 123.08stable no longer works with ngx_pagespeed, you need to update to 123.09beta01 for ngx_pagespeed. See news thread at Nginx 1.9.11 dynamic module compatibility. 123.08stable has disabled ngx_pagespeed and lua nginx modules due to incompatibility with nginx 1.9.11 dynamic modules.

    If you want ngx_pagespeed for now you need to update Centmin Mod to 123.09beta01 outlined here Beta Branch - Centmin Mod .09 beta branch Testing

    With 123.09beta01, set in /etc/centminmod/custom_config.inc persistent config file you create or already created and set:
    Code (Text):
    NGINX_PAGESPEED=y
    NGXDYNAMIC_NGXPAGESPEED=y
    

    and then recompile Nginx 1.11.4 or higher via centmin.sh menu option 4

    Then tweak pagespeed.conf for your site and troubleshoot. Here's some links for examples and help
    1. https://centminmod.com/nginx_ngx_pagespeed.htm
    2. Nginx PageSpeed - This forum's pagespeed.conf | Centmin Mod Community
    3. Nginx PageSpeed - Nginx Pagespeed Troubleshooting steps | Centmin Mod Community
    4. Nginx, PHP-FPM & MariaDB MySQL | Centmin Mod Community
    5. Install & Upgrades or Pre-Install Questions | Centmin Mod Community
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Also to to troubleshoot nginx upgrade, 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 nginx_upgrade.log 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

    you can use grep to filter the logs, i.e. look for nginx_upgrade in log name
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep nginx_upgrade
    -rw-r--r--  1 root root 3.2M Oct 11 15:55 centminmod_1.2.3-eva2000.09.001_111016-155345_nginx_upgrade.log
    -rw-r--r--  1 root root 672K Oct 11 22:06 centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log

    So the last nginx upgrade log was named centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log and located at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log
    then use cat command to output the contents of that log

    clear your ssh window buffer/screen and type
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log

    then select and copy and paste output to pastebin.com or gist.github.com file to share

    so only need content of one specific log, in this case most recent nginx_upgrade.log log
     
  4. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    8:06 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    I am already on 123.09beta01.
    Just rebuilt/upgraded to Nginx 1.11.6 with "NGXDYNAMIC_NGXPAGESPEED=y" because I never had that in my config file (even when PageSpeed was working correctly).

    Uncommenting "include /usr/local/nginx/conf/pagespeedadmin.conf;" and running "nginx -t" returns same error:
    Code (Text):
    nginx: [emerg] unknown directive "pagespeed" in /usr/local/nginx/conf/pagespeedadmin.conf:9
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

    Here is my latest log file:
    nginx_upgrade.log · GitHub

    I know it's a small amount, but I really appreciate the help so far!
    Just sent a $5 AUD donation with the PayPal button :)
     
  5. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    much appreciated :)

    how did you edit persistent config file /etc/centminmod/custom_config.inc ? there's a cmd shortcut = customconfig which invokes nano linux text editor to edit /etc/centminmod/custom_config.inc too

    there's no pagespeed module enabled from logs so that suggests you setup persistent config file /etc/centminmod/custom_config.inc variables incorrectly to enable ngx_pagespeed

    Code (Text):
    nginx configure options (alternate ordering):
    ./configure --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib" --with-cc-opt="-m64 -mtune=native -mfpmath=sse -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" --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_secure_link_module --add-module=../nginx-module-vts --with-libatomic --with-http_gzip_static_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-threads --with-stream=dynamic --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=../ngx-fancyindex-0.4.0 --add-module=../ngx_cache_purge-2.3 --add-module=../ngx_devel_kit-0.3.0 --add-module=../set-misc-nginx-module-0.31 --add-module=../echo-nginx-module-0.60 --add-module=../redis2-nginx-module-0.13 --add-module=../ngx_http_redis-0.3.7 --add-module=../memc-nginx-module-0.17 --add-module=../srcache-nginx-module-0.31 --add-module=../headers-more-nginx-module-0.32 --with-pcre=../pcre-8.39 --with-pcre-jit --with-http_ssl_module --with-http_v2_module --with-openssl=../libressl-2.4.4
    checking for OS
     + Linux 4.8.6-x86_64-linode78 x86_64
    checking for C compiler ... found
     + using Clang C compiler
     + clang version: 3.4.2 (tags/RELEASE_34/dot2-final)
    checking for --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib" ... found
    checking for -Wl,-E switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for gcc builtin 64 bit byteswap ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for EPOLLRDHUP ... found
    checking for EPOLLEXCLUSIVE ... not found
    checking for O_PATH ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_REUSEPORT ... found
    checking for SO_ACCEPTFILTER ... not found
    checking for SO_BINDANY ... not found
    checking for IP_BIND_ADDRESS_NO_PORT ... not found
    checking for IP_TRANSPARENT ... found
    checking for IP_BINDANY ... not found
    checking for IP_RECVDSTADDR ... not found
    checking for IP_PKTINFO ... found
    checking for IPV6_RECVPKTINFO ... found
    checking for TCP_DEFER_ACCEPT ... found
    checking for TCP_KEEPIDLE ... found
    checking for TCP_FASTOPEN ... found
    checking for TCP_INFO ... found
    checking for accept4() ... found
    checking for eventfd() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint32_t ... found
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system byte ordering ... little endian
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for AF_INET6 ... found
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for pwritev() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    checking for openat(), fstatat() ... found
    checking for getaddrinfo() ... found
    configuring additional modules
    adding module in ../nginx-module-vts
     + ngx_http_vhost_traffic_status_module was configured
    adding module in ../ngx_cache_purge-2.3
     + ngx_http_cache_purge_module was configured
    adding module in ../ngx_devel_kit-0.3.0
     + ngx_devel_kit was configured
    adding module in ../set-misc-nginx-module-0.31
    found ngx_devel_kit for ngx_set_misc; looks good.
     + ngx_http_set_misc_module was configured
    adding module in ../echo-nginx-module-0.60
     + ngx_http_echo_module was configured
    adding module in ../redis2-nginx-module-0.13
     + ngx_http_redis2_module was configured
    adding module in ../ngx_http_redis-0.3.7
     + ngx_http_redis_module was configured
    adding module in ../memc-nginx-module-0.17
     + ngx_http_memc_module was configured
    adding module in ../srcache-nginx-module-0.31
     + ngx_http_srcache_filter_module was configured
    adding module in ../headers-more-nginx-module-0.32
     + ngx_http_headers_more_filter_module was configured
    configuring additional dynamic modules
    adding module in ../ngx-fancyindex-0.4.0
     + ngx_http_fancyindex_module was configured
    checking for zlib library ... found
    checking for GD library ... found
    checking for GD WebP support ... not found
    checking for GeoIP library ... found
    checking for GeoIP IPv6 support ... found
    checking for atomic_ops library ... found
    creating objs/Makefile
    
    Configuration summary
      + using threads
      + using PCRE library: ../pcre-8.39
      + using OpenSSL library: ../libressl-2.4.4
      + using system zlib library
      + using system libatomic_ops library
    
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/sbin/nginx"
      nginx modules path: "/usr/local/nginx/modules"
      nginx configuration prefix: "/usr/local/nginx/conf"
      nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
      nginx pid file: "/usr/local/nginx/logs/nginx.pid"
      nginx error log file: "/usr/local/nginx/logs/error.log"
      nginx http access log file: "/usr/local/nginx/logs/access.log"
      nginx http client request body temporary files: "client_body_temp"
      nginx http proxy temporary files: "proxy_temp"
      nginx http fastcgi temporary files: "fastcgi_temp"
      nginx http uwsgi temporary files: "uwsgi_temp"
      nginx http scgi temporary files: "scgi_temp"
    
    
    Tue Nov 29 03:07:05 UTC 2016
    Success: Nginx configure ok


    so run these commands to setup persistent config file /etc/centminmod/custom_config.inc correctly in SSH which creates /etc/centminmod directory and the /etc/centminmod/custom_config.inc file via touch comand then appends via echo to /etc/centminmod/custom_config.inc file the 2 variables and that cat command to output contents of /etc/centminmod/custom_config.inc
    Code (Text):
    mkdir -p /etc/centminmod/
    cp -a /etc/centminmod/custom_config.inc /etc/centminmod/custom_config.inc.bak
    rm -rf /etc/centminmod/custom_config.inc
    touch /etc/centminmod/custom_config.inc
    echo "NGXDYNAMIC_NGXPAGESPEED='y'" >> /etc/centminmod/custom_config.inc
    echo "NGINX_PAGESPEED='y'" >> /etc/centminmod/custom_config.inc
    cat /etc/centminmod/custom_config.inc

    then recompile nginx via centmin.sh menu option 4
     
  6. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    8:06 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Hmm, it appears that I am no longer receiving the Failure to start Nginx after rebuilding this time. Do you think it was the persistent config file?

    My config:
    Code (Text):
    NGXDYNAMIC_NGXPAGESPEED=y
    NGINX_PAGESPEED=y
    LETSENCRYPT_DETECT=y

    Your config:
    Code (Text):
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    LETSENCRYPT_DETECT='y'

    Does ='y' and =y actually make a difference :(
    I'm certain that is the only thing that changed between the two setups...

    Here is the latest log file:
    nginx_upgrade.log NEW · GitHub
     
  7. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    'y' or y shouldn't make a different but how you created and edited /etc/centminmod/custom_config.inc might
     
  8. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks good from your latest log
    Code (Text):
    dynamic modules include file /usr/local/nginx/conf/dynamic-modules.conf
    -rw-r--r-- 1 root root 192 Nov 29 04:05 /usr/local/nginx/conf/dynamic-modules.conf
    
    load_module "modules/ngx_http_image_filter_module.so";
    load_module "modules/ngx_http_fancyindex_module.so";
    load_module "modules/ngx_pagespeed.so";
    load_module "modules/ngx_stream_module.so";
    
    dynamic module directory at /usr/local/nginx/modules
    total 20M
    drwxr-xr-x  2 root root 4.0K Nov 29 04:11 .
    drwxr-xr-x 10 root root 4.0K Sep 11 21:28 ..
    -rwxr-xr-x  1 root root 151K Nov 29 04:11 ngx_http_fancyindex_module.so
    -rwxr-xr-x  1 root root 143K Nov 29 03:08 ngx_http_fancyindex_module.so.old
    -rwxr-xr-x  1 root root 152K Nov 29 04:11 ngx_http_image_filter_module.so
    -rwxr-xr-x  1 root root 146K Nov 29 03:08 ngx_http_image_filter_module.so.old
    -rwxr-xr-x  1 root root  17M Nov 29 04:11 ngx_pagespeed.so
    -rwxr-xr-x  1 root root 1.2M Nov 29 04:11 ngx_stream_module.so
    -rwxr-xr-x  1 root root 1.2M Nov 29 03:08 ngx_stream_module.so.old
    
    log files saved at /root/centminlogs
    -rw-r--r-- 1 root root    45 Nov 29 04:05 centminmod_libresslinstalltime_291116-040336.log
    -rw-r--r-- 1 root root     0 Nov 29 04:05 patch_patchnginx_291116-040336.log
    -rw-r--r-- 1 root root  1.3K Nov 29 04:05 nginx-configure-291116-040336.log
    -rw-r--r-- 1 root root   22K Nov 29 04:11 nginx_autoconf.err.291116-040336.log
    -rw-r--r-- 1 root root 1014K Nov 29 04:11 centminmod_1.2.3-eva2000.09.001_291116-040336_nginx_upgrade.log
    
     
  9. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    8:06 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Created file via FTP and used a text editor to save and upload
     
  10. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah that's the problem most likely use linux native text editor like nano or vim instead

    nano which you can read up more about nano here and here. For vim text editor read here and here.

    Also there's numerous online how to use guides for nano and vim you can search for via google :)
     
  11. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    8:06 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Yeah I just always preferred text editors.
    I guess it's a good time to learn now haha!

    Thanks again for the help with my issues. Wish I could contribute more but there's not much less technical stuff on the forum :)
     
  12. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  13. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    5:06 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    You can use notepad++ to create file and then upload to browser, but make sure that before saving file (if you for example creating bash script) select option Edit => EOL conversion => Unix

    But probably best option is to execute command
    Code:
    nano /etc/centminmod/custom_config.inc
    And copy/paste directly (or edit) into it.
    after finishing, for nano you have to ctrl+O for save, confirm with enter and than ctrl+X to exit
     
  14. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    1:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup that works too