Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx Optimizing Your Website with the Google PageSpeed Dynamic Module for NGINX Plus

Discussion in 'Nginx and PHP-FPM news & discussions' started by eva2000, Mar 4, 2017.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    54,087
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    9:24 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Nginx Inc now offers commercial Nginx Plus web server with Google PageSpeed Dynamic Module support. The ngx_pagespeed Nginx module is something that Centmin Mod already offers via free open source Nginx version already and can be enabled in latest Centmin Mod 123.09beta01 version as outlined at here :)

    For Nginx Plus commercial web server, Google PageSpeed Dynamic Module Google PageSpeed as a Dynamic Module for NGINX Plus

     
    Last edited: Mar 4, 2017
  2. eva2000

    eva2000 Administrator Staff Member

    54,087
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    9:24 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Centmin Mod already offers via free open source Nginx version already and can be enabled in latest Centmin Mod 123.09beta01 version as outlined at here and is one of the performance configuration tips I listed in my guide at Insight Guide - How to boost Centmin Mod LEMP stack performance. Centmin Mod Nginx has supported ngx_pagspeed since June 2013 and supported Nginx PageSpeed module as a dynamic module since February 2016. The benefits that Nginx PageSpeed provide of improved page load speed are real Nginx PageSpeed - Benefits of ngx_pagespeed :)

    Enabling Google PageSpeed Support In Centmin Mod Nginx



    To enable support for ngx_pagespeed on Centmin Mod 123.09beta01, set in persistent config file /etc/centminmod/custom_config.inc the following variables
    Code (Text):
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    

    Then recompile latest Nginx 1.13.8 1.19.2 or higher version via centmin.sh menu option 4. Result is
    Centmin Mod installs Nginx dynamic modules to /usr/local/nginx/modules. The .old ones are auto renamed from previous Nginx compiles by Nginx - sort of a backup.
    Code (Text):
    ls -lah /usr/local/nginx/modules
    total 2.9M
    drwxr-xr-x.  2 root root 4.0K Jan 12 08:56 .
    drwxr-xr-x. 11 root root 4.0K Jan  3 00:31 ..
    -rwxr-xr-x   1 root root 792K Jan 12 08:56 ngx_http_brotli_filter_module.so
    -rwxr-xr-x   1 root root 792K Jan 12 07:46 ngx_http_brotli_filter_module.so.old
    -rwxr-xr-x   1 root root  14K Jan 12 08:56 ngx_http_brotli_static_module.so
    -rwxr-xr-x   1 root root  14K Jan 12 07:46 ngx_http_brotli_static_module.so.old
    -rwxr-xr-x   1 root root  63K Jan 12 08:56 ngx_http_echo_module.so
    -rwxr-xr-x   1 root root  63K Jan 12 07:46 ngx_http_echo_module.so.old
    -rwxr-xr-x   1 root root  29K Jan 12 08:56 ngx_http_fancyindex_module.so
    -rwxr-xr-x   1 root root  29K Jan 12 07:46 ngx_http_fancyindex_module.so.old
    -rwxr-xr-x   1 root root  42K Jan 12 08:56 ngx_http_headers_more_filter_module.so
    -rwxr-xr-x   1 root root  42K Jan 12 07:46 ngx_http_headers_more_filter_module.so.old
    -rwxr-xr-x   1 root root  28K Jan 12 08:56 ngx_http_image_filter_module.so
    -rwxr-xr-x   1 root root  28K Jan 12 07:46 ngx_http_image_filter_module.so.old
    -rwxr-xr-x   1 root root  36K Jan 12 08:56 ngx_http_set_misc_module.so
    -rwxr-xr-x   1 root root  36K Jan 12 07:46 ngx_http_set_misc_module.so.old
    -rwxr-xr-x   1 root root 234K Jan 12 08:56 ngx_http_vhost_traffic_status_module.so
    -rwxr-xr-x   1 root root 234K Jan 12 07:46 ngx_http_vhost_traffic_status_module.so.old
    -rwxr-xr-x   1 root root 198K Jan 12 08:56 ngx_stream_module.so
    -rwxr-xr-x   1 root root 198K Jan 12 07:46 ngx_stream_module.so.old
    

    The Nginx dynamic modules are loaded via include file /usr/local/nginx/conf/dynamic-modules.conf in /usr/local/nginx/conf/nginx.conf

    In /usr/local/nginx/conf/nginx.conf
    Code (Text):
    include /usr/local/nginx/conf/dynamic-modules.conf;
    

    contents of /usr/local/nginx/conf/dynamic-modules.conf
    Code (Text):
    # place custom load_module lines in this dynamic-modules-includes.conf
    # file so that they persistent i.e. for manually dropped in dynamic modules
    include /usr/local/nginx/conf/dynamic-modules-includes.conf;
    load_module "modules/ngx_http_image_filter_module.so";
    load_module "modules/ngx_http_headers_more_filter_module.so";
    load_module "modules/ngx_http_set_misc_module.so";
    load_module "modules/ngx_http_echo_module.so";
    load_module "modules/ngx_http_fancyindex_module.so";
    load_module "modules/ngx_http_vhost_traffic_status_module.so";
    load_module "modules/ngx_http_brotli_filter_module.so";
    load_module "modules/ngx_http_brotli_static_module.so";
    load_module "modules/ngx_stream_module.so";
    

    The image filter, fancyindex and stream modules are default enabled Nginx dynamic modules. Nginx pagespeed and Brotli ones are optionally enabled by me via persistent config file set variables prior to centmin.sh menu option 4 recompile of Nginx.
    Code (Text):
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    NGXDYNAMIC_BROTLI=y
    NGINX_LIBBROTLI=y
    


    Nginx PageSpeed Configuration



    Once ngx_pagespeed is compiled and installed into Nginx, you need to configure the pagespeed.conf and nginx pagespeed filters as outlined here and below links. Specifically for your web site and web site's theme and page elements. No one web site will have exact same pagespeed.conf settings and pagespeed filter combinations.

    Nginx PageSpeed Troubleshooting



    You'd have to troubleshoot and tweak it yourself following these guides and info outlined below

    Other Nginx PageSpeed Links & Info


    Official Nginx PageSpeed Documentation


    • Official Nginx PageSpeed documentation is hosted on mod_pagespeed site at Installing From Packages. Mod_pagespeed is the Apache version of Google PageSpeed. So docs outline both mod_pagespeed for Apache and ngx_pagespeed for Nginx in the same manual :)
     
    Last edited: Mar 4, 2017
  3. eva2000

    eva2000 Administrator Staff Member

    54,087
    12,177
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,735
    Local Time:
    9:24 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
Thread Status:
Not open for further replies.