Get the most out of your Centmin Mod LEMP stack
Become a Member

Beta Branch update PHP-FPM config default templates etc in 123.09beta01

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

  1. eva2000

    eva2000 Administrator Staff Member

    45,201
    10,279
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,932
    Local Time:
    9:05 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    update PHP-FPM config default templates etc in 123.09beta01

    - Below updates are only for new 123.09beta01 installs so as to not overwrite customisations made by users. Existing users can manually edit global section of /usr/local/etc/php-fpm.conf, /usr/local/nginx/conf/php.conf and /usr/local/nginx/conf/default_phpupstream.conf and manually setup /usr/local/nginx/conf/phpfpmd/phpfpm_pool1_uds.conf file and then restart nginx and php-fpm
    - Update template used for /usr/local/etc/php-fpm.conf to raise global php-fpm values for emergency_restart_threshold and process_control_timeout from 10 and 10s to 100 and 185s respectively. .

    Code (Text):
    emergency_restart_threshold = 100
    emergency_restart_interval = 1m
    process_control_timeout = 185s


    - Update template used for /usr/local/nginx/conf/php.conf to raise fastcgi_connect_timeout, fastcgi_send_timeout and fastcgi_read_timeout value to 360 and disable via comment out with hash # in front of fastcgi_keep_conn directive to disable persistent php-fpm connections for less throughput but higher concurrent load handling

    Code (Text):
    #fastcgi_keep_conn on;
    fastcgi_connect_timeout 360;
    fastcgi_send_timeout 360;
    fastcgi_read_timeout 360;


    - Update template used for /usr/local/nginx/conf/default_phpupstream.conf default PHP-FPM upstream named dft_php. Set dftphp_zone buffer to 256K. Note keepalive doesn't take effect as fastcgi_keep_conn is now disabled/commented out by default

    Updated /usr/local/nginx/conf/default_phpupstream.conf looks like this now

    Code (Text):
    upstream dft_php {
      zone dftphp_zone 256k;
      server 127.0.0.1:9000;
      keepalive 2;
    }


    - Add a PHP-FPM unix socket pool for /var/run/php-fpm/php-fpm-pool1-uds.sock that can be optionally used at /usr/local/nginx/conf/phpfpmd/phpfpm_pool1_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_pool1_uds.conf to /usr/local/nginx/conf/phpfpmd/phpfpm_pool1_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

    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;
      keepalive 2;
    }


    It's recommended to use TCP by default instead of PHP-FPM unix socket where possible but you can experiment for yourself

    Continue reading...

    123.09beta01 branch
     
  2. rdan

    rdan Well-Known Member

    4,983
    1,185
    113
    May 25, 2014
    Ratings:
    +1,804
    Local Time:
    7:05 PM
    Mainline
    10.2
  3. eva2000

    eva2000 Administrator Staff Member

    45,201
    10,279
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,932
    Local Time:
    9:05 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
  4. eva2000

    eva2000 Administrator Staff Member

    45,201
    10,279
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,932
    Local Time:
    9:05 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x