Join the community today
Become a Member

Featured Upgrade Nginx Redis Insight Guide Tracking Centmin Mod Config Changes Which Are Not Automatically Synced

Discussion in 'Centmin Mod Insights' started by eva2000, May 19, 2017.

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

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    It was discussed at https://community.centminmod.com/th...onf-include-file-cache-control-headers.11728/ of how to track some Centmin Mod config file changes which do not automatically get sync'd on Centmin Mod centmin.sh menu option 23 submenu option 2 updates and needing manual changing and visual comparisons for.

    Why?



    Centmin Mod generally does not auto change config files after post initial install unless it's a security or severe bug fix. The reason is because, end users can customise their config files themselves for their needs and auto making changes may break the end users customised settings.

    Files To Track



    These are some of the files which may get changes which may need manual updates or have had dynamic updates made on the defaults based on your server specs
    • /usr/local/nginx/conf/nginx.conf
    • /usr/local/nginx/conf/conf.d/virtual.conf
    • /usr/local/nginx/conf/staticfiles.conf
    • /usr/local/etc/php-fpm.conf
    • /usr/local/nginx/conf/php.conf
    • /usr/local/nginx/conf/drop.conf
    • /usr/local/nginx/conf/errorpage.conf
    • /usr/local/nginx/conf/pagespeed.conf
    • /usr/local/nginx/conf/pagespeedhandler.conf
    • /usr/local/nginx/conf/pagespeedstatslog.conf
    I outlined some tips for this including using sdiff/diff commands in SSH to visually check for differences with Centmin Mod copy in /usr/local/src/centminmod and the live server config files in play

    i.e.

    server copy /usr/local/nginx/conf/nginx.conf
    vs
    centmin mod copy /usr/local/src/centminmod/config/nginx/nginx.conf

    Notes:
    • sdiff could cut off characters in display so diff -u command is more accurate

    sdiff:


    You can use sdiff to do diff side by side compare within ssh provided your ssh client is configured with wider screen width buffer

    i.e. sdiff with width of 200 to compare the latest copies locally available in /usr/local/src/centminmod with ones live on server
    Code (Text):
    sdiff -w200 /usr/local/nginx/conf/nginx.conf /usr/local/src/centminmod/config/nginx/nginx.conf
    sdiff -w200 /usr/local/nginx/conf/conf.d/virtual.conf /usr/local/src/centminmod/config/nginx/conf.d/virtual.conf
    sdiff -w200 /usr/local/nginx/conf/staticfiles.conf /usr/local/src/centminmod/config/nginx/staticfiles.conf
    sdiff -w200 /usr/local/nginx/conf/php.conf /usr/local/src/centminmod/config/nginx/php.conf
    sdiff -w200 /usr/local/nginx/conf/drop.conf /usr/local/src/centminmod/config/nginx/drop.conf
    sdiff -w200 /usr/local/nginx/conf/errorpage.conf /usr/local/src/centminmod/config/nginx/errorpage.conf
    sdiff -w200 /usr/local/nginx/conf/pagespeed.conf /usr/local/src/centminmod/config/nginx/pagespeed.conf
    sdiff -w200 /usr/local/nginx/conf/pagespeedhandler.conf /usr/local/src/centminmod/config/nginx/pagespeedhandler.conf
    sdiff -w200 /usr/local/nginx/conf/pagespeedstatslog.conf /usr/local/src/centminmod/config/nginx/pagespeedstatslog.conf
    sdiff -w200 /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm.conf
    sdiff -w200 /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm-min.conf
    

    Code (Text):
    sdiff -w200 -s /usr/local/nginx/conf/nginx.conf /usr/local/src/centminmod/config/nginx/nginx.conf
    sdiff -w200 -s /usr/local/nginx/conf/conf.d/virtual.conf /usr/local/src/centminmod/config/nginx/conf.d/virtual.conf
    sdiff -w200 -s /usr/local/nginx/conf/staticfiles.conf /usr/local/src/centminmod/config/nginx/staticfiles.conf
    sdiff -w200 -s /usr/local/nginx/conf/php.conf /usr/local/src/centminmod/config/nginx/php.conf
    sdiff -w200 -s /usr/local/nginx/conf/drop.conf /usr/local/src/centminmod/config/nginx/drop.conf
    sdiff -w200 -s /usr/local/nginx/conf/errorpage.conf /usr/local/src/centminmod/config/nginx/errorpage.conf
    sdiff -w200 -s /usr/local/nginx/conf/pagespeed.conf /usr/local/src/centminmod/config/nginx/pagespeed.conf
    sdiff -w200 -s /usr/local/nginx/conf/pagespeedhandler.conf /usr/local/src/centminmod/config/nginx/pagespeedhandler.conf
    sdiff -w200 -s /usr/local/nginx/conf/pagespeedstatslog.conf /usr/local/src/centminmod/config/nginx/pagespeedstatslog.conf
    sdiff -w200 -s /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm.conf
    sdiff -w200 -s /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm-min.conf
    


    diff:

    Code (Text):
    diff -u /usr/local/nginx/conf/nginx.conf /usr/local/src/centminmod/config/nginx/nginx.conf
    diff -u /usr/local/nginx/conf/conf.d/virtual.conf /usr/local/src/centminmod/config/nginx/conf.d/virtual.conf
    diff -u /usr/local/nginx/conf/staticfiles.conf /usr/local/src/centminmod/config/nginx/staticfiles.conf
    diff -u /usr/local/nginx/conf/php.conf /usr/local/src/centminmod/config/nginx/php.conf
    diff -u /usr/local/nginx/conf/drop.conf /usr/local/src/centminmod/config/nginx/drop.conf
    diff -u /usr/local/nginx/conf/errorpage.conf /usr/local/src/centminmod/config/nginx/errorpage.conf
    diff -u /usr/local/nginx/conf/pagespeed.conf /usr/local/src/centminmod/config/nginx/pagespeed.conf
    diff -u /usr/local/nginx/conf/pagespeedhandler.conf /usr/local/src/centminmod/config/nginx/pagespeedhandler.conf
    diff -u /usr/local/nginx/conf/pagespeedstatslog.conf /usr/local/src/centminmod/config/nginx/pagespeedstatslog.conf
    diff -u /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm.conf
    diff -u /usr/local/etc/php-fpm.conf /usr/local/src/centminmod/config/php-fpm/php-fpm-min.conf
    

    example
    Code (Text):
    diff -u /usr/local/nginx/conf/staticfiles.conf /usr/local/src/centminmod/config/nginx/staticfiles.conf
    --- /usr/local/nginx/conf/staticfiles.conf      2017-04-14 13:28:00.648971866 +0000
    +++ /usr/local/src/centminmod/config/nginx/staticfiles.conf     2017-05-18 14:38:01.877605699 +0000
    @@ -9,7 +9,7 @@
       #add_header X-Xss-Protection "1; mode=block" always;
       #add_header X-Content-Type-Options "nosniff" always;
       add_header Access-Control-Allow-Origin *;
    -  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    +  add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
            access_log off;
            expires 30d;
            break;
    @@ -21,7 +21,7 @@
       #add_header X-Xss-Protection "1; mode=block" always;
       #add_header X-Content-Type-Options "nosniff" always;
       add_header Access-Control-Allow-Origin *;
    -  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    +  add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
            access_log off;
            expires 30d;
            break;
    @@ -33,7 +33,7 @@
       #add_header X-Xss-Protection "1; mode=block" always;
       #add_header X-Content-Type-Options "nosniff" always;
       add_header Access-Control-Allow-Origin *;
    -  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    +  add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
            access_log off;
            expires 30d;
            break;
    

    means
    Code (Text):
    -  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    +  add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
    

    replace all 3 instances of
    Code (Text):
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    

    with
    Code (Text):
    add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
    
     
    Last edited: May 19, 2017
Thread Status:
Not open for further replies.