Join the community today
Register Now

Beta Branch update fpmstats & phpstatus.conf & add 2nd/3rd PHP-FPM UDS pool templates in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Sep 4, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    6:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    update fpmstats & phpstatus.conf & add 2nd/3rd PHP-FPM UDS pool templates in 123.09beta01

    - Below updates are only for new 123.09beta01 installs so as to not overwrite customisations made by users. Existing users can follow manual instructions below IF they want to enable add additional PHP-FPM pools that are unix socket based
    - Related to Beta Branch - update PHP-FPM config default templates etc in 123.09beta01 and addition of unix socket PHP-FPM pool support. This update will update /usr/bin/fpmstats command to also output PHP-FPM pool stats for any predefined unix socket PHP-FPM pools which PHP-FPM status pages if they're enabled in /usr/local/nginx/conf/phpstatus.conf at localhost/phpstatus-pool1-uds, localhost/phpstatus-pool2-uds or localhost/phpstatus-pool3-uds. Existing users can update /usr/bin/fpmstats with below contents

    contents of updated /usr/bin/fpmstats

    Code (Text):
    systemctl daemon-reload;
    systemctl show php-fpm -p StatusText --no-pager | awk -F '=' '{print $2}';
    phpstatuscheck=$(curl -sI localhost/phpstatus 2>&1 | head -n1 | grep -o 200);
    phpstatusuds1check=$(curl -sI localhost/phpstatus-pool1-uds 2>&1 | head -n1 | grep -o 200);
    phpstatusuds2check=$(curl -sI localhost/phpstatus-pool2-uds 2>&1 | head -n1 | grep -o 200);
    phpstatusuds3check=$(curl -sI localhost/phpstatus-pool3-uds 2>&1 | head -n1 | grep -o 200);
    if [[ "$phpstatuscheck" -eq '200' ]]; then
      curl -s localhost/phpstatus;
    fi
    if [[ "$phpstatusuds1check" -eq '200' ]]; then
      echo
      curl -s localhost/phpstatus-pool1-uds;
    fi
    if [[ "$phpstatusuds2check" -eq '200' ]]; then
      echo
      curl -s localhost/phpstatus-pool2-uds;
    fi
    if [[ "$phpstatusuds3check" -eq '200' ]]; then
      echo
      curl -s localhost/phpstatus-pool3-uds;
    fi



    and updated fpmstats output

    Code (Text):
    fpmstats
    Ready to handle connections
    pool:                 www
    process manager:      ondemand
    start time:           04/Sep/2020:04:06:05 +0000
    start since:          2
    accepted conn:        28
    listen queue:         0
    max listen queue:     0
    listen queue len:     65535
    idle processes:       0
    active processes:     1
    total processes:      1
    max active processes: 1
    max children reached: 0
    slow requests:        0
    
    pool:                 pool1-uds
    process manager:      ondemand
    start time:           04/Sep/2020:04:06:05 +0000
    start since:          2
    accepted conn:        28
    listen queue:         0
    max listen queue:     0
    listen queue len:     0
    idle processes:       0
    active processes:     1
    total processes:      1
    max active processes: 1
    max children reached: 0
    slow requests:        0
    
    pool:                 pool2-uds
    process manager:      ondemand
    start time:           04/Sep/2020:04:06:05 +0000
    start since:          2
    accepted conn:        28
    listen queue:         0
    max listen queue:     0
    listen queue len:     0
    idle processes:       0
    active processes:     1
    total processes:      1
    max active processes: 1
    max children reached: 0
    slow requests:        0
    
    pool:                 pool3-uds
    process manager:      ondemand
    start time:           04/Sep/2020:04:06:05 +0000
    start since:          2
    accepted conn:        28
    listen queue:         0
    max listen queue:     0
    listen queue len:     0
    idle processes:       0
    active processes:     1
    total processes:      1
    max active processes: 1
    max children reached: 0
    slow requests:        0


    - Updated /usr/local/nginx/conf/phpstatus.conf with PHP-FPM status pages support for localhost/phpstatus-pool1-uds, localhost/phpstatus-pool2-uds or localhost/phpstatus-pool3-uds. Existing 123.09beta01 users will need to update via cmupdate command and then copy /usr/local/src/centminmod/config/nginx/phpstatus.conf to /usr/local/nginx/conf/phpstatus.conf
    - Add a PHP-FPM unix socket pool 2 additional PHP-FPM pools for /var/run/php-fpm/php-fpm-pool2-uds.sock and /var/run/php-fpm/php-fpm-pool3-uds.sock that can be optionally used at /usr/local/nginx/conf/phpfpmd/phpfpm_pool2_uds.conf and /usr/local/nginx/conf/phpfpmd/phpfpm_pool3_uds.conf when in /usr/local/etc/php-fpm.conf you uncomment include like and remove semi-colon.

    from

    Code (Text):
    ;include=/usr/local/nginx/conf/phpfpmd/*.conf


    to

    Code (Text):
    include=/usr/local/nginx/conf/phpfpmd/*.conf


    Existing 123.09beta01 users will need to update via cmupdate command and then copy /usr/local/src/centminmod/config/nginx/phpfpmd/phpfpm_pool2_uds.conf to /usr/local/nginx/conf/phpfpmd/phpfpm_pool2_uds.conf and copy /usr/local/src/centminmod/config/nginx/phpfpmd/phpfpm_pool3_uds.conf to /usr/local/nginx/conf/phpfpmd/phpfpm_pool3_uds.conf and restart nginx and php-fpm services

    Then you can update and switch from TCP to unix socket PHP-FPM by editing /usr/local/nginx/conf/default_phpupstream.conf to below using all or one of the 3 PHP-FPM unix socket pools

    Code (Text):
    upstream dft_php {
      zone dftphp_zone 256k;
    #  server 127.0.0.1:9000;
      server unix:/var/run/php-fpm/php-fpm-pool1-uds.sock;
      server unix:/var/run/php-fpm/php-fpm-pool2-uds.sock;
      server unix:/var/run/php-fpm/php-fpm-pool3-uds.sock;
      keepalive 2;
    }


    Continue reading...

    123.09beta01 branch
     
  2. David Schargel

    David Schargel Premium Member Premium Member

    38
    9
    8
    Feb 2, 2020
    Portland Oregon US
    Ratings:
    +23
    Local Time:
    1:24 PM
    Is this still recommended for 'older' servers?

    David
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    6:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Default is usually recommended. So if you're older server is running previous defaults, updating manually to listed above defaults should be fine. It's only when you have modified your existing server defaults, that I or Centmin Mod code can't expect PHP-FPM to run as intended that issues may arise. Hence, not auto updating older/existing installs.