Role Detail

geerlingguy.apache-php-fpm

Apache 2.4+ PHP-FPM support for Linux.
Downloads
25142
Type Ansible
Minimum Ansible Version 1.4
Installation $ ansible-galaxy install geerlingguy.apache-php-fpm
Tags
web
Last Commit 2017-03-31 16:23:04 PM UTC
Last Imported 2017-04-02 12:24:12 PM UTC
Version History
Version Release Date
1.0.2 2016-04-22 19:07:07 PM
1.0.1 2016-02-02 17:21:05 PM
1.0.0 2016-01-15 04:29:04 AM
0.2.0 2016-01-14 05:25:05 AM
0.1.0 2016-01-14 03:34:03 AM
Supported Platforms
Platform Version
Debian jessie
Debian wheezy
EL 6
EL 7
Ubuntu precise
Ubuntu trusty
Ubuntu xenial
Dependencies
Role
Last 10 Imports
Completed Status
2017-04-02 12:24:12 PM UTC SUCCESS
2017-04-02 05:02:05 AM UTC SUCCESS
2017-04-02 03:46:03 AM UTC SUCCESS
2017-01-22 02:10:02 AM UTC SUCCESS
2016-11-02 20:20:08 PM UTC SUCCESS
2016-10-23 06:57:06 AM UTC SUCCESS
2016-09-30 14:31:02 PM UTC SUCCESS
2016-09-25 20:57:08 PM UTC SUCCESS
2016-09-25 20:07:08 PM UTC SUCCESS
2016-09-01 01:50:01 AM UTC SUCCESS

Ansible Role: Apache PHP-FPM

Build Status

An Ansible Role that configures Apache for PHP-FPM usage on RHEL/CentOS and Debian/Ubuntu.

Requirements

This role is dependent upon geerlingguy.apache, and also requires you have PHP running with PHP-FPM somewhere on the server or elsewhere (I usually configure PHP with the geerlingguy.php role).

Additionally, this role will only work correctly if you have Apache 2.4.9+ installed; on older versions of Debian/Ubuntu Linux (e.g. 12.04), you can add ppa:ondrej/apache2 prior to Apache installation to install Apache 2.4, for example:

- name: Add repository for Apache 2.4 on Ubuntu 12.04.
  apt_repository: repo='ppa:ondrej/apache2'
  when: ansible_distribution_version == "12.04"

When configuring your Apache virtual hosts, you can add the following line to any vhost definition to enable passthrough to PHP-FPM:

# If using a TCP port:
ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/var/www/example"

# If using a Unix socket:
ProxyPassMatch ^/(.*\.php(/.*)?)$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/var/www/example"

For a full usage example with the geerlingguy.apache role, see the Example Playbook later in this README.

Role Variables

None.

Dependencies

None.

Example Playbook

- hosts: webservers

  vars:
    apache_vhosts:
      - servername: "www.example.com"
        documentroot: "/var/www/example"
        extra_parameters: |
              ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/var/www/example"

  roles:
    - geerlingguy.apache
    - geerlingguy.php
    - geerlingguy.apache-php-fpm

License

MIT / BSD

Author Information

This role was created in 2016 by Jeff Geerling, author of Ansible for DevOps.

None