Role that installs php-fpm.

This commit is contained in:
Andrea Dell'Amico 2020-04-27 20:13:34 +02:00
parent 3f41ec9760
commit 732f7ae002
7 changed files with 634 additions and 0 deletions

96
defaults/main.yml Normal file
View File

@ -0,0 +1,96 @@
---
#
# IMPORTANT: the template will be used on a task that refers 'phpfpm_pools' inside a 'with_items' loop. So
# the variables into the template are all 'item.XXX'
#
phpfpm_service_enabled: True
phpfpm_remove_php_module: True
php_from_ppa: False
php_ppa: ppa:ondrej/php
php_version: 7.2
php_run_dir: '/run/php'
phpfpm_root_dir: '/etc/php/{{ php_version }}'
phpfpm_base_dir: '{{ phpfpm_root_dir }}/fpm'
phpfpm_cli_dir: '{{ phpfpm_root_dir }}/cli'
php_fpm_packages:
- 'php{{ php_version }}-fpm'
- 'php{{ php_version }}-cli'
#php_global_settings:
# - { option: '', value: '', state: '' }
#php_cli_global_settings:
# - { option: '', value: '', state: '' }
# Main confign file settings
# It can be 'syslog'
phpfpm_logdir: /var/log/php-fpm
phpfpm_error_logfile: '/var/log/php{{ php_version }}-fpm.log'
phpfpm_syslog_facility: daemon
phpfpm_syslog_ident: php-fpm
phpfpm_log_level: notice
phpfpm_emergency_restart_threshold: 5
phpfpm_emergency_restart_interval: 2m
phpfpm_process_control_timeout: 10s
phpfpm_set_process_max: False
phpfpm_process_max: 256
phpfpm_set_event_mechanism: False
phpfpm_event_mechanism: epoll
# Pools settings
phpfpm_default_pool_name: "php-fpm"
phpfpm_pool_name: "{{ phpfpm_default_pool_name }}"
phpfpm_remove_default_pool: True
phpfpm_use_default_template: True
phpfpm_create_users: True
phpfpm_default_user: php-fpm
phpfpm_default_group: '{{ phpfpm_default_user }}'
phpfpm_listen_on_socket: True
phpfpm_default_listen: "{{ php_run_dir }}/{{ phpfpm_pool_name }}.sock"
#phpfpm_default_listen: "127.0.0.1:9000"
phpfpm_default_listen_backlog: '-1'
phpfpm_default_allowed_clients: "127.0.0.1"
phpfpm_default_pm: "dynamic"
phpfpm_default_pm_max_children: "50"
phpfpm_default_pm_start_servers: "8"
phpfpm_default_pm_min_spare_servers: "5"
phpfpm_default_pm_max_spare_servers: "12"
phpfpm_default_pm_max_requests: "10000"
phpfpm_default_pm_status_enabled: False
phpfpm_default_pm_status_path: "/status"
phpfpm_default_ping_enabled: False
phpfpm_default_ping_path: "/ping"
phpfpm_default_ping_response: '{{ phpfpm_default_pool_name }}'
phpfpm_default_display_errors: "off"
phpfpm_default_log_errors: "on"
phpfpm_default_memory_limit: "64M"
phpfpm_default_default_upload_maxsize: "20M"
phpfpm_default_post_max_filesize: "{{ phpfpm_default_default_upload_maxsize }}"
phpfpm_default_tmp_dir: "/var/tmp"
phpfpm_default_request_terminate_timeout: "240s"
phpfpm_default_slowlog_timeout: "20s"
phpfpm_default_rlimit_files: "4096"
phpfpm_default_extensions: ".php"
phpfpm_default_context: '/'
phpfpm_default_session_handler: 'files'
phpfpm_default_session_prefix: '/var/lib/php'
phpfpm_default_session_dir: '{{ phpfpm_default_session_prefix }}/sessions'
phpfpm_default_define_custom_variables: False
phpfpm_use_memcache_redundancy_sessions: False
phpfpm_use_memcached_redundancy_sessions: False
memcache_session:
- { prop: 'memcache.allow_failover', value: 1 }
- { prop: 'memcache.session_redundancy', value: 3 }
- { prop: 'memcache.hash_strategy', value: 'standard' }
- { prop: 'memcache.max_failover_attempts', value: '20' }
phpfpm_php_variables:
- { prop: 'session.gc_maxlifetime', value: 1440 }
- { prop: 'session.cache_expire', value: 180 }
phpfpm_pools:
- { pool_name: '{{ phpfpm_default_pool_name }}', app_context: '{{ phpfpm_default_context }}', user: '{{ phpfpm_default_user }}', group: '{{ phpfpm_default_group }}', listen: '{{ phpfpm_default_listen }}', listen_backlog: '{{ phpfpm_default_listen_backlog }}', allowed_clients: '{{ phpfpm_default_allowed_clients }}', pm: '{{ phpfpm_default_pm }}', pm_max_children: '{{ phpfpm_default_pm_max_children }}', pm_start_servers: '{{ phpfpm_default_pm_start_servers }}', pm_min_spare: '{{ phpfpm_default_pm_min_spare_servers }}', pm_max_spare: '{{ phpfpm_default_pm_max_spare_servers }}', pm_max_requests: '{{ phpfpm_default_pm_max_requests }}', pm_status_enabled: '{{ phpfpm_default_pm_status_enabled }}', pm_status_path: '{{ phpfpm_default_pm_status_path }}', ping_enabled: '{{ phpfpm_default_ping_enabled }}', ping_path: '{{ phpfpm_default_ping_path }}', ping_response: '{{ phpfpm_default_ping_response }}', display_errors: '{{ phpfpm_default_display_errors }}', log_errors: '{{ phpfpm_default_log_errors }}', memory_limit: '{{ phpfpm_default_memory_limit }}', slowlog_timeout: '{{ phpfpm_default_slowlog_timeout }}', rlimit_files: '{{ phpfpm_default_rlimit_files }}', php_extensions: '{{ phpfpm_default_extensions }}', define_custom_variables: '{{ phpfpm_default_define_custom_variables }}' }

8
handlers/main.yml Normal file
View File

@ -0,0 +1,8 @@
---
- name: Reload php-fpm
service: name=php{{ php_version }}-fpm state=reloaded
when: phpfpm_service_enabled | bool
- name: Restart php-fpm
service: name=php{{ php_version }}-fpm state=restarted
when: phpfpm_service_enabled | bool

16
meta/main.yml Normal file
View File

@ -0,0 +1,16 @@
---
galaxy_info:
author: adellam
description: PHP-FPM installation and configuration
company: ISTI-CNR
license: license (EUPL)
min_ansible_version: 2.7
platforms:
- name: EL
versions:
- 7
galaxy_tags:
- php
- php-fpm
dependencies: []

93
tasks/main.yml Normal file
View File

@ -0,0 +1,93 @@
---
# php as a standalone service
- name: Install the repository if required, and the packages
block:
- name: Install the Ubuntu PHP PPA
apt_repository: repo={{ php_ppa }} state=present update_cache=yes
when: php_from_ppa | bool
- name: Remove the Ubuntu PHP PPA
apt_repository: repo={{ php_ppa }} state=absent update_cache=yes
when: not php_from_ppa | bool
- name: Install the php-fpm package
apt: pkg={{ php_fpm_packages }} state=present update_cache=yes cache_valid_time=3600
- name: Install additional php packages
apt: pkg={{ php_additional_packages | default([]) }} state=present update_cache=yes cache_valid_time=3600
tags: [ 'php', 'php_ppa' ]
- name: Configure PHP
block:
- name: Set the timezone if we have one
ini_file: dest={{ phpfpm_base_dir }}/php.ini section=Date option=date.timezone value={{ timezone }} backup=yes
when: timezone is defined
notify: Reload php-fpm
- name: Modify the global php settings
ini_file: dest={{ phpfpm_base_dir }}/php.ini section={{ item.section | default('PHP') }} option={{ item.option }} value={{ item.value }} backup=yes state={{ item.state | default('present') }}
with_items: '{{ php_global_settings | default([]) }}'
notify: Reload php-fpm
- name: Modify the global php cli settings
ini_file: dest={{ phpfpm_cli_dir }}/php.ini section={{ item.section | default('PHP') }} option={{ item.option }} value={{ item.value }} state={{ item.state | default('present') }}
with_items: '{{ php_cli_global_settings | default([]) }}'
- name: Activate the memcache sessions support and redundancy if required
action: configfile path={{ phpfpm_base_dir }}/conf.d/20-memcache.ini key={{ item.prop }} value='{{ item.value }}'
when: phpfpm_use_memcache_redundancy_sessions | bool
with_items: '{{ memcache_session }}'
notify: Reload php-fpm
- name: remove php-fpm default pool
file: dest={{ phpfpm_base_dir }}/pool.d/www.conf state=absent
when: phpfpm_remove_default_pool | bool
notify: Restart php-fpm
- name: Create the users under the php-fpm processes will run
user: name={{ item.user }} comment="{{ item.user }}" home=/dev/null createhome=no shell=/sbin/nologin
with_items: '{{ phpfpm_pools }}'
when: phpfpm_create_users | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_pool' ]
- name: Create the directories where to store the sessions files. One for each pool
file: dest={{ phpfpm_session_prefix }}/{{ item.pool_name }} owner={{ item.user }} group=root mode=0750 state=directory
with_items: '{{ phpfpm_pools }}'
when:
- phpfpm_session_prefix is defined
- phpfpm_use_default_template | bool
tags: [ 'php', 'fpm_pool' ]
- name: Create the directories where to store the log files
file: dest={{ phpfpm_logdir }} owner=root group=root mode=0750 state=directory
tags: [ 'php', 'fpm_pool' ]
- name: Install the php-fpm logrotate file
template: src=php-fpm.logrotate.j2 dest=/etc/logrotate.d/php-fpm owner=root group=root mode=0444
tags: [ 'php', 'fpm_conf' ]
- name: Install the php-fpm main config file
template: src=php-fpm.conf.j2 dest={{ phpfpm_base_dir }}/php-fpm.conf owner=root group=root mode=0444
notify: Restart php-fpm
- name: Install the php-fpm pools
template: src=php-fpm-pool.conf.j2 dest={{ phpfpm_base_dir }}/pool.d/{{ item.pool_name }}.conf owner=root group=root mode=0444
with_items: '{{ phpfpm_pools }}'
when: phpfpm_use_default_template | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_conf', 'fpm_pool', 'fpm_pool_conf' ]
- name: Manage the php-fpm service
block:
- name: Ensure that the php-fpm service is started and enabled
service: name=php{{ php_version }}-fpm state=started enabled=yes
when: phpfpm_service_enabled | bool
- name: Ensure that the php-fpm service is stopped and disabled
service: name=php{{ php_version }}-fpm state=stopped enabled=no
when: not phpfpm_service_enabled | bool
tags: php

View File

@ -0,0 +1,296 @@
; Start a new pool named 'www'.
[{{ item.pool_name | default('www') }}]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = {{ item.listen | default ('127.0.0.1:9000') }}
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
listen.backlog = {{ item.listen_backlog }}
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = {{ item.allowed_clients | default ('127.0.0.1') }}
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
{% if phpfpm_listen_on_socket %}
listen.owner = {{ item.user }}
listen.group = www-data
listen.mode = 0660
{% endif %}
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = {{ item.user | default('php-fpm') }}
; RPM: Keep a group allowed to write in log dir.
group = {{ item.group | default('php-fpm') }}
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives:
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; Note: This value is mandatory.
pm = {{ item.pm | default('dynamic') }}
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes to be created when pm is set to 'dynamic'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = {{ item.pm_max_children | default('50') }}
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = {{ item.pm_start_servers | default('3') }}
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = {{ item.pm_min_spare | default('1') }}
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = {{ item.pm_max_spare | default('10') }}
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = {{ item.pm_max_requests | default('10000') }}
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. By default, the status page shows the following
; information:
; accepted conn - the number of request accepted by the pool;
; pool - the name of the pool;
; process manager - static or dynamic;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes.
; The values of 'idle processes', 'active processes' and 'total processes' are
; updated each second. The value of 'accepted conn' is updated in real time.
; Example output:
; accepted conn: 12073
; pool: www
; process manager: static
; idle processes: 35
; active processes: 65
; total processes: 100
; By default the status page output is formatted as text/plain. Passing either
; 'html' or 'json' as a query string will return the corresponding output
; syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
pm.status_path = {{ item.pm_status_path | default('/status') }}
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
ping.path = {{ item.ping_path | default('/ping') }}
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
ping.response = {{ item.ping_response | default('www') }}
access.log = /var/log/php-fpm/$pool-access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: ouput header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request
; %q: the query string
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
access.format = "%{REMOTE_ADDR}e - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_terminate_timeout = {{ item.req_term_timeout | default('240s') }}
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = {{ item.slowlog_timeout | default('20s') }}
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/php-fpm/$pool-slow.log
; Set open file descriptor rlimit.
; Default Value: system defined value
rlimit_files = {{ item.rlimit_files | default('4096') }}
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start. This value must be an absolute path.
; Default Value: current directory or / when chroot
;chdir = /var/www
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Default Value: no
catch_workers_output = yes
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
security.limit_extensions = {{ item.php_extensions | default('.php') }}
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
php_flag[display_errors] = {{ item.display_errors | default(phpfpm_default_display_errors) }}
php_admin_value[error_log] = {{ phpfpm_logdir }}/$pool-error.log
php_admin_flag[log_errors] = {{ item.log_errors | default(phpfpm_default_log_errors) }}
php_admin_value[memory_limit] = {{ item.memory_limit | default(phpfpm_default_memory_limit) }}
php_admin_value[upload_max_filesize] = {{ item.upload_max_filesize | default(phpfpm_default_default_upload_maxsize) }}
php_admin_value[post_max_size] = {{ item.post_max_filesize | default(phpfpm_default_post_max_filesize) }}
php_admin_value[upload_tmp_dir] = {{ item.upload_tmp_dir | default(phpfpm_default_tmp_dir) }}
; Set session path to a directory owned by process user
php_value[session.save_handler] = '{{ item.session_save_handler | default('files') }}'
{% if phpfpm_session_prefix is defined %}
php_value[session.save_path] = '{{ phpfpm_session_prefix }}/{{ item.pool_name }}'
{% else %}
php_value[session.save_path] = '{{ phpfpm_default_session_dir }}'
{% endif %}
{% if item.define_custom_variables is defined and item.define_custom_variables %}
{% for php_var in phpfpm_php_variables %}
php_value[{{ php_var.prop }}] = {{ php_var.value }}
{% endfor %}
{% endif %}

115
templates/php-fpm.conf.j2 Normal file
View File

@ -0,0 +1,115 @@
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
;include={{ phpfpm_base_dir }}/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Default Value: none
pid = /run/php/php{{ php_version }}-fpm.pid
; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Default Value: /var/log/php-fpm.log
error_log = {{ phpfpm_error_logfile }}
{% if phpfpm_error_logfile == 'syslog' %}
; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
syslog.facility = {{ phpfpm_syslog_facility }}
; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
syslog.ident = {{ phpfpm_syslog_ident }}
{% endif %}
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
log_level = {{ phpfpm_log_level }}
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
emergency_restart_threshold = {{ phpfpm_emergency_restart_threshold }}
; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
emergency_restart_interval = {{ phpfpm_emergency_restart_interval }}
; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
process_control_timeout = {{ phpfpm_process_control_timeout }}
; The maximum number of processes FPM will fork. This has been design to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
{% if phpfpm_set_process_max %}
process.max = {{ phpfpm_process_max }}
{% endif %}
; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool process will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
;process.priority = -19
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = yes
; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
{% if phpfpm_set_event_mechanism %}
; Specify the event mechanism FPM will use. The following is available:
; - select (any POSIX os)
; - poll (any POSIX os)
; - epoll (linux >= 2.5.44)
; Default Value: not set (auto detection)
events.mechanism = {{ phpfpm_event_mechanism }}
{% endif %}
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; See /etc/php-fpm.d/*.conf
; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
include={{ phpfpm_base_dir }}/pool.d/*.conf

View File

@ -0,0 +1,10 @@
{{ phpfpm_logdir}}/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/usr/lib/php5/php5-fpm-reopenlogs
endscript
}