Skip to content

Commit f300087

Browse files
committed
Update PHP and Nginx configurations for improved performance and resource handling
Signed-off-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>
1 parent 5ce51af commit f300087

7 files changed

Lines changed: 20 additions & 19 deletions

File tree

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ ENV BUILD_PHP_VERSION=$PHP_VERSION \
142142
PHP_ERROR_REPORTING="22527" \
143143
PHP_MAX_EXECUTION_TIME="99" \
144144
PHP_MAX_INPUT_TIME="-1" \
145+
PHP_MAX_INPUT_VARS="5000" \
145146
PHP_MEMORY_LIMIT="256M" \
146147
PHP_OPCACHE_ENABLE="0" \
147148
PHP_OPCACHE_INTERNED_STRINGS_BUFFER="16" \
@@ -153,6 +154,8 @@ ENV BUILD_PHP_VERSION=$PHP_VERSION \
153154
PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \
154155
PHP_OPEN_BASEDIR="" \
155156
PHP_POST_MAX_SIZE="100M" \
157+
PHP_REALPATH_CACHE_SIZE="4096k" \
158+
PHP_REALPATH_CACHE_TTL="120" \
156159
PHP_SESSION_COOKIE_SECURE=true \
157160
PHP_UPLOAD_MAX_FILE_SIZE="100M"
158161

@@ -288,9 +291,7 @@ ENTRYPOINT ["/init"]
288291

289292
FROM base AS web-base
290293

291-
ENV NGINX_FASTCGI_BUFFERS="8 8k" \
292-
NGINX_FASTCGI_BUFFER_SIZE="8k" \
293-
NGINX_SERVER_TOKENS=off \
294+
ENV NGINX_SERVER_TOKENS=off \
294295
NGINX_WEBROOT=/var/www/html/public
295296

296297
RUN apt-get update \

docker/devops

docker/etc/nginx/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pid /run/nginx.pid;
33
daemon off;
44

55
events {
6-
worker_connections 768;
6+
worker_connections 1024;
77
# multi_accept on;
88
}
99

docker/etc/nginx/site-opts.d/http.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ location ~ \.php$ {
3030
fastcgi_index index.php;
3131
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3232
include fastcgi_params;
33-
fastcgi_buffers 8 8k;
34-
fastcgi_buffer_size 8k;
33+
fastcgi_buffers 16 16k;
34+
fastcgi_buffer_size 16k;
3535
}
3636

3737
# widgets/portals assets - pass to PHP/Laravel only
@@ -41,8 +41,8 @@ location ~ ^/(widgets|portals)/.*\.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|c
4141
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
4242
fastcgi_param QUERY_STRING $query_string;
4343
include fastcgi_params;
44-
fastcgi_buffers 8 8k;
45-
fastcgi_buffer_size 8k;
44+
fastcgi_buffers 16 16k;
45+
fastcgi_buffer_size 16k;
4646
}
4747

4848
# additional config

docker/etc/nginx/site-opts.d/https.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ location ~ \.php$ {
3434
fastcgi_index index.php;
3535
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3636
include fastcgi_params;
37-
fastcgi_buffers 8 8k;
38-
fastcgi_buffer_size 8k;
37+
fastcgi_buffers 16 16k;
38+
fastcgi_buffer_size 16k;
3939
}
4040

4141
# widgets/portals assets - pass to PHP/Laravel only
@@ -45,8 +45,8 @@ location ~ ^/(widgets|portals)/.*\.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|c
4545
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
4646
fastcgi_param QUERY_STRING $query_string;
4747
include fastcgi_params;
48-
fastcgi_buffers 8 8k;
49-
fastcgi_buffer_size 8k;
48+
fastcgi_buffers 16 16k;
49+
fastcgi_buffer_size 16k;
5050
}
5151

5252
# additional config

docker/etc/php/8.4/cli/php.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ disable_classes =
348348
; the file operations performed.
349349
; Note: if open_basedir is set, the cache is disabled
350350
; https://php.net/realpath-cache-size
351-
;realpath_cache_size = 4096k
351+
realpath_cache_size=${PHP_REALPATH_CACHE_SIZE}
352352

353353
; Duration of time, in seconds for which to cache realpath information for a given
354354
; file or directory. For systems with rarely changing files, consider increasing this
355355
; value.
356356
; https://php.net/realpath-cache-ttl
357-
;realpath_cache_ttl = 120
357+
realpath_cache_ttl=${PHP_REALPATH_CACHE_TTL}
358358

359359
; Enables or disables the circular reference collector.
360360
; https://php.net/zend.enable-gc
@@ -423,7 +423,7 @@ max_input_time = ${PHP_MAX_INPUT_TIME}
423423
;max_input_nesting_level = 64
424424

425425
; How many GET/POST/COOKIE input variables may be accepted
426-
;max_input_vars = 1000
426+
max_input_vars=${PHP_MAX_INPUT_VARS}
427427

428428
; How many multipart body parts (combined input variable and file uploads) may
429429
; be accepted.

docker/etc/php/8.4/fpm/php.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ disable_classes =
348348
; the file operations performed.
349349
; Note: if open_basedir is set, the cache is disabled
350350
; https://php.net/realpath-cache-size
351-
;realpath_cache_size = 4096k
351+
realpath_cache_size=${PHP_REALPATH_CACHE_SIZE}
352352

353353
; Duration of time, in seconds for which to cache realpath information for a given
354354
; file or directory. For systems with rarely changing files, consider increasing this
355355
; value.
356356
; https://php.net/realpath-cache-ttl
357-
;realpath_cache_ttl = 120
357+
realpath_cache_ttl=${PHP_REALPATH_CACHE_TTL}
358358

359359
; Enables or disables the circular reference collector.
360360
; https://php.net/zend.enable-gc
@@ -423,7 +423,7 @@ max_input_time = ${PHP_MAX_INPUT_TIME}
423423
;max_input_nesting_level = 64
424424

425425
; How many GET/POST/COOKIE input variables may be accepted
426-
;max_input_vars = 1000
426+
max_input_vars=${PHP_MAX_INPUT_VARS}
427427

428428
; How many multipart body parts (combined input variable and file uploads) may
429429
; be accepted.

0 commit comments

Comments
 (0)