This is an Ansible role for installing PHP-FPM.
Installs the php5-fpm
package.
It also deletes the default (www
) resource pool. See the usage
section below for how to create your own pools. You can disable this
feature by setting php_fpm_delete_default_pool
to false
.
Creates the files:
/etc/php5/fpm/php.ini
-- configuration file for PHP
Provides the service php5-fpm
but it won't start running until you
define a pool (or unless you allowed the default pool to persist).
Use the role in a playbook like this:
- hosts: all
roles:
- php-fpm
To set up your own pool, you can use the provided template:
- name: Create PHP-FPM pool for MyApp
template: src=${PHP-FPM}/templates/pool.conf.j2 dest={{ php_fpm_conf_dir }}/pool.d/my-app.conf owner=root group=root mode=0644
notify:
- restart php-fpm
tags:
- my-app
- php-fpm
- php
with_items:
- name: my-app
root: /srv/my-app
user: www-data
group: www-data
listen: /srv/my-app/tmp/php5-fpm.sock"
status_path: /_fpm_status
log_dir: /var/log/my-app
See the complete list of variables below.
The following variables are exposed for configuration:
php_fpm_delete_default_pool
-- set tofalse
to disable deleting the default (www
) PHP-FPM resource poolphp_fpm_post_max_size
-- PHP post max size (default: 8M)php_fpm_max_execution_time
-- PHP max execution time (default: 30)php_fpm_max_input_time
-- PHP max input time (default: 60)php_fpm_memory_limit
-- PHP memory limit (default: 128M)php_fpm_time_zone
-- PHP time zone (default: UTC)php_fpm_upload_max_file_size
-- PHP upload max file size (default: 2M)
When using the pool.conf.j2
template (see above), the following
variables are exposed:
name
-- name of the poolroot
-- change to this directory before starting processesuser
-- user of the processes in the poolgroup
-- group of the processes in the poollisten
-- either a port or path for a UNIX socketstatus_path
-- expose the PHP-FPM status pathping_path
-- expose the PHP-FPM ping pathlog_dir
-- the log directory for PHP-FPM processes