From 1167368f3a91597ed6c70bbd892b4ad51c784976 Mon Sep 17 00:00:00 2001 From: Ainsley Ellis Date: Tue, 3 Dec 2024 15:48:49 +0000 Subject: [PATCH] Use PHP-FPM pooling --- config/apache/app.sixfold.org.conf | 20 ++++++++++++++++++++ config/php/fpm/app.sixfold.org.conf | 19 +++++++++++++++++++ config/php/fpm/app.sixfold.org.ini | 6 ------ 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 config/php/fpm/app.sixfold.org.conf diff --git a/config/apache/app.sixfold.org.conf b/config/apache/app.sixfold.org.conf index 9d79634..0cdd30f 100644 --- a/config/apache/app.sixfold.org.conf +++ b/config/apache/app.sixfold.org.conf @@ -23,8 +23,28 @@ # Allow access to www/ Require all granted + + # Pass HTTP Authorization headers to PHP-FPM + CGIPassAuth on + # PHP-FPM configuration + # See https://serverfault.com/questions/450628/apache-2-4-php-fpm-proxypassmatch/510784 + + # Required for FPM to receive POST data sent with Transfer-Encoding: chunked + SetEnv proxy-sendcl 1 + + # Forward all PHP requests to the php-fpm pool for this domain. + + SetHandler "proxy:unix:/run/php/app.dev.sixfold.org.sock|fcgi://app.dev.sixfold.org" + Header set Cache-Control "no-store" + + + # Set some proxy properties. + + ProxySet connectiontimeout=5 timeout=240 + + RewriteEngine On diff --git a/config/php/fpm/app.sixfold.org.conf b/config/php/fpm/app.sixfold.org.conf new file mode 100644 index 0000000..46791f4 --- /dev/null +++ b/config/php/fpm/app.sixfold.org.conf @@ -0,0 +1,19 @@ +[app.sixfold.org] +user = www-data +group = www-data + +listen = /run/php/app.sixfold.org.sock +listen.owner = www-data +listen.group = www-data + +pm = ondemand +pm.max_children = 20 +pm.process_idle_timeout = 30s +pm.max_requests = 200 + +request_slowlog_timeout = 10s +slowlog = /var/log/local/php-fpm-slow.log +catch_workers_output = yes + +php_admin_value[include_path] = /srv/app.sixfold.org/lib +php_admin_value[auto_prepend_file] = config.php diff --git a/config/php/fpm/app.sixfold.org.ini b/config/php/fpm/app.sixfold.org.ini index 92c0fe9..38c986e 100644 --- a/config/php/fpm/app.sixfold.org.ini +++ b/config/php/fpm/app.sixfold.org.ini @@ -13,14 +13,8 @@ expose_php = Off post_max_size = 10M upload_max_filesize = 6M -include_path = /srv/app.sixfold.org/lib -auto_prepend_file = config.php - [session] session.use_strict_mode = Off [Date] date.timezone = Etc/UTC - -[app] -app.site_status = "live"