Join the community today
Register Now

Master Branch update fpmstats & phpstatus.conf & add 2nd/3rd PHP-FPM UDS pool templ…

Discussion in 'Centmin Mod Github Commits' started by eva2000, Sep 16, 2020 at 8:42 AM.

  1. eva2000

    eva2000 Administrator Staff Member

    45,151
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    6:01 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    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 https://community.centminmod.com/threads/update-php-fpm-config-default-templates-etc-in-123-09beta01.20303/ 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

    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

    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

    ;include=/usr/local/nginx/conf/phpfpmd/*.conf

    to

    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

    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...

    Centmin Mod Github Master branch

    Master branch is where most recent commits are made as at May 24, 2015.