geerlingguy.apache-php-fpm
Rol de Ansible: Apache PHP-FPM
Una rol de Ansible que configura Apache para el uso de PHP-FPM en RHEL/CentOS y Debian/Ubuntu.
Requisitos
Este rol depende de geerlingguy.apache
, y también necesita que tengas PHP funcionando con PHP-FPM en algún lugar del servidor o en otro lugar (normalmente configuro PHP con el rol geerlingguy.php
).
Al configurar tus hosts virtuales de Apache, puedes añadir la siguiente línea a cualquier definición de vhost para habilitar la conexión con PHP-FPM:
# Si usas un puerto TCP:
ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/var/www/example"
# Si usas un socket Unix:
ProxyPassMatch ^/(.*\.php(/.*)?)$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/var/www/example"
Para un ejemplo completo de uso con el rol geerlingguy.apache
, consulta el Ejemplo de Playbook más adelante en este README.
RedHat 6 y 7
RedHat/CentOS 7 instala y habilita automáticamente mod_proxy_fcgi por defecto.
RedHat/CentOS 6 instala Apache 2.2, y es mucho más difícil de configurar con FastCGI, pero aquí hay dos guías en caso de que necesites soportar este caso de uso:
Variables del Rol
Ninguna.
Dependencias
Ninguna.
Ejemplo de Playbook
- hosts: webservers
vars:
php_enable_php_fpm: true
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
Licencia
MIT / BSD
Información del Autor
Este rol fue creado en 2016 por Jeff Geerling, autor de Ansible for DevOps.
ansible-galaxy install geerlingguy.apache-php-fpm