New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Community Discussion) Default settings for PHP and Apache/Nginx #302

Closed
cytopia opened this Issue Jul 5, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@cytopia
Copy link
Owner

cytopia commented Jul 5, 2018

Community Discussion: Default settings for PHP and Apache/Nginx

I would like to standardize sane default settings for PHP and Apache/Nginx across all of their versions.


Todo

Webserver

  • timeout
  • timeout to upstream PHP-FPM connection: 180sec
  • body/post size

Done

PHP

Defaults for PHP are available here:

php-fpm.conf

[global]
log_level = notice

[www]
request_terminate_timeout = 120s
listen.backlog = 1024
pm = ondemand
pm.max_children = 50
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.max_requests = 500
pm.process_idle_timeout = 10s

php.ini

memory_limit		= 512M

max_execution_time      = 120
max_input_time          = 120

post_max_size           = 72M
upload_max_filesize     = 64M
max_file_uploads        = 20

variables_order         = EGPCS
max_input_vars          = 8000
max_input_nesting_level = 64

error_reporting         = E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED
xmlrpc_errors           = Off
report_memleaks         = On
display_errors          = On
display_startup_errors  = On
track_errors            = On
log_errors              = On
html_errors             = On

xdebug.default_enable   = Off
xdebug.profiler_enable  = Off
xdebug.remote_enable    = Off
xdebug.remote_autostart = Off
@Tuurlijk

This comment has been minimized.

Copy link

Tuurlijk commented Jul 15, 2018

for MySQL I have found these settings help:

max_allowed_packet=64M
tmpdir=/dev/shm

max_allowed_packet helps when importing dumps with long lines. It prevents the 'mysql has gone away' message.

For PHP

[PHP]
; Memory
memory_limit = 512M

; Timeouts
max_execution_time = 240
max_input_time = 240

; Uploads
post_max_size = 256M
upload_max_filesize = 256M

; Vars
max_input_vars = 8000

; Error reporting
display_errors = On
track_errors = On

; Opcache boost
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 16
opcache.validate_timestamps = 0

; Mailhog
sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'
@jukben

This comment has been minimized.

Copy link

jukben commented Jul 27, 2018

Hey! It would be awesome to create one config file (or maybe as a part of .env) for those general configurations (as upload_max_filesize) to share them automatically across versions depend on your configuration. That would help me a lot 👍 What do you think?

@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Jul 27, 2018

@jukben those standard settings will be baked into each container by default, once they have been defined. So there will be no need for the user to apply standard settings, only to change those.

@jukben

This comment has been minimized.

Copy link

jukben commented Jul 27, 2018

On the other hand, yep, that would definitely solve my problem why I had to mess with config in the first place #323 Thanks for working on this. 🙌

@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Jul 28, 2018

php.ini defaults

How it works

  1. Every flavour inherits from the its previous flavor (prod from base and work from prod).
  2. Every flavour can overwrite previous flavour values (e.g. work overwrites base error_reporting settings)
@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Jul 29, 2018

Quick update: PHP defaults PR has been merged and new Images should be available in 1-2 hours.

@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Jul 29, 2018

@Tuurlijk I left out opcache settings at the moment as I am not very experienced with it.

@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Aug 1, 2018

I am adding new PHP-FPM settings: devilbox/docker-php-fpm#40 to solve the following issue: #234

pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500

Update

The above settings not valid anymore

For new settings see initial post at the very top

@cytopia cytopia referenced this issue Aug 12, 2018

Merged

Devilbox intranet, docs and fixes #351

6 of 6 tasks complete

@cytopia cytopia changed the title (Community Feedback) Default settings for PHP and Apache/Nginx (Community Discussion) Default settings for PHP and Apache/Nginx Sep 30, 2018

@cytopia cytopia added discussion and removed docker help wanted labels Sep 30, 2018

@cytopia

This comment has been minimized.

Copy link
Owner Author

cytopia commented Jan 4, 2019

Migration note

Community discussion will be continued on The Devilbox Forums in topic: Default settings for PHP-FPM


mention: @Tuurlijk @jukben @9034725985

@cytopia cytopia closed this Jan 4, 2019

Repository owner locked as off topic and limited conversation to collaborators Jan 4, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.