add support for php

This commit is contained in:
genofire 2020-07-22 01:50:30 +02:00
parent c3c9fddc12
commit 8e524d2a8e
5 changed files with 59 additions and 0 deletions

View File

@ -1 +1,3 @@
---
# webserver_dehydrated_email: "" # required
webserver_php_enabled: false

View File

@ -6,3 +6,8 @@
- name: dehydrated
command: /usr/bin/dehydrated -c
- name: restart php-fpm
systemd:
name: php-fpm
state: restarted

View File

@ -67,6 +67,10 @@
state: started
enabled: yes
- name: php
import_tasks: php.yml
when: webserver_php_enabled
- name: enabled nginx
systemd:
name: nginx

34
tasks/php.yml Normal file
View File

@ -0,0 +1,34 @@
---
- name: Install php
package:
state: latest
name:
- php-fpm
- php-gd
- php-imap
- name: enable extension
notify: restart php-fpm
lineinfile:
path: /etc/php/php.ini
regexp: ';extension={{ item }}'
line: "extension={{ item }}"
with_items:
- curl
- gd
- imap
- mysqli
- pdo_mysql
- zip
- name: enabled and started php-fpm
systemd:
name: php-fpm
enabled: yes
state: started
- name: templates php nginx
notify: reload nginx
template:
src: "php.nginx"
dest: "/etc/nginx/snippets/php.conf"

14
templates/php.nginx Normal file
View File

@ -0,0 +1,14 @@
index index.html index.htm index.php;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root:/tmp:/usr/share/pear:/dev/urandom;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
}