;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; author: SlickStack ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; link: https://slickstack.io ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; mirror: https://mirrors.slickstack.io/modules/php-fpm/8.1/www-conf.txt ;;;;;;;;;;;;;;;;;;;;;;;; ;;;; path: n/a (boilerplate) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; destination: /etc/php/8.1/fpm/pool.d/www.conf (after install) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; purpose: WWW pool configuration file boilerplate optimized for SlickStack servers ;;;;;;;;;;;;; ;;;; module version: PHP-FPM 8.1.x ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; sourced by: php-fpm.conf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; bash aliases: n/a (ss-install-php-config) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [www] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; WWW.conf: Pool Settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; users/groups and listen directives are hardcoded in SlickStack for better stability ;; ;; only high-traffic sites or uncommon stacks should adjust these in ss-config ;; ;; prefix = /path/to/pools/$pool user = www-data group = www-data listen = 127.0.0.1:9000 ;; avoids disk I/O listen.backlog = @WWW_LISTEN_BACKLOG ;; ss = 65535 listen.allowed_clients = 127.0.0.1 ;; process.priority = -19 ;; for multi-website (shared hosting) servers only process.dumpable = no pm = @WWW_PM_MODE ;; ss = ondemand pm.max_children = @WWW_PM_MAX_CHILDREN ;; ss = 20 pm.start_servers = @WWW_PM_START_SERVERS ;; ss = 2 (used only for dynamic) pm.min_spare_servers = @WWW_PM_MIN_SPARE_SERVERS ;; ss = 1 (used only for dynamic) pm.max_spare_servers = @WWW_PM_MAX_SPARE_SERVERS ;; ss = 3 (used only for dynamic) pm.max_spawn_rate = @WWW_PM_MAX_SPAWN_RATE ;; ss = 32 (used only for dynamic) ;; PHP 8.1+ pm.process_idle_timeout = @WWW_PM_PROCESS_IDLE_TIMEOUT; ;; ss = 10s (used only for ondemand) pm.max_requests = @WWW_PM_MAX_REQUESTS ;; ss = 500 ;; pm.status_path = ;; pm.status_listen = 127.0.0.1:9001 ;; PHP 8.0+ ;; ping.path = /ping ;; ping.response = pong ;; access.log = log/$pool.access.log ;; access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" ;; slowlog = log/$pool.log.slow ;; request_slowlog_timeout = 0 ;; request_slowlog_trace_depth = 20 request_terminate_timeout = @WWW_REQUEST_TERMINATE_TIMEOUT ;; ss = 60s ;; request_terminate_timeout_track_finished = no ;; PHP 7.3+ rlimit_files = @WWW_RLIMIT_FILES ;; ss = 65535 rlimit_core = @WWW_RLIMIT_CORE ;; ss = 0 ;; chroot = ;; chdir = /var/www catch_workers_output = yes decorate_workers_output = no ;; PHP 7.4+ clear_env = yes security.limit_extensions = .php ;; env[HOSTNAME] = $HOSTNAME ;; env[PATH] = /usr/local/bin:/usr/bin:/bin ;; env[TMP] = /tmp ;; env[TMPDIR] = /tmp ;; env[TEMP] = /tmp ;; php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com ;; php_flag[display_errors] = off php_admin_value[error_log] = /var/www/logs/php-error.log php_admin_flag[log_errors] = on ;; php_admin_value[memory_limit] = 32M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Ref: https://github.com/php/php-src/blob/php-8.1.1/sapi/fpm/www.conf.in ;; Ref: https://gist.github.com/holmberd/44fa5c2555139a1a46e01434d3aaa512 ;; Ref: https://easyengine.io/docs/prevent-mysql-crashing ;; Ref: https://gist.github.com/fyrebase/62262b1ff33a6aaf5a54 ;; Ref: https://www.kinamo.be/en/support/faq/determining-the-correct-number-of-child-processes-for-php-fpm-on-nginx ;; Ref: https://geekflare.com/php-fpm-optimization/ ;; Ref: https://ma.ttias.be/a-better-way-to-run-php-fpm/ ;; Ref: https://haydenjames.io/php-fpm-tuning-using-pm-static-max-performance/ ;; Ref: https://serversforhackers.com/c/php-fpm-configuration-the-listen-directive ;; Ref: https://easyengine.io/tutorials/php/fpm-sysctl-tweaking/ ;; Ref: https://ypereirareis.github.io/blog/2017/02/20/php-fpm-cli-error-log/ ;; Ref: https://stackoverflow.com/questions/12461810/php-fpm-too-many-open-files ;; Ref: https://www.digitalocean.com/community/questions/optimizing-php7-with-nginx ;; Ref: https://server-support.co/sysadmin/webhosting/sysadmin-php-fpm-modular-config/ ;; Ref: https://serversforhackers.com/c/php-fpm-process-management ;; Ref: https://dev.to/jake/configuring-php-fpm-for-high-network-traffic-47le ;; Ref: https://ypereirareis.github.io/blog/2019/07/30/php-fpm-truncated-log-workaround-solution-trick/ ;; Ref: https://stackoverflow.com/questions/48863756/log-to-stdout-stderr-with-laravel-5-6-and-php-fpm ;; Ref: https://rascaldev.io/2018/01/09/tuning-phps-fastcgi-process-manager-php-fpm/ ;; Ref: https://developpaper.com/understand-php-process-manager-php-fpm/ ;; Ref: https://www.php.net/manual/en/migration81.new-features.php ;; Ref: https://community.centminmod.com/threads/add-pm-max_spawn_rate-for-php-8-1-only-in-123-09beta01.22227/ ;; Ref: https://webdock.io/en/docs/perfect-server-stacks/stacks ;; Ref: https://www.php.net/manual/en/migration80.new-features.php ;; SS_EOF