added support for php ini values and custom vhost config

This commit is contained in:
nd 2019-04-27 21:47:33 +02:00
parent a7a49f80d3
commit 9289015473
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
4 changed files with 26 additions and 4 deletions

View file

@ -29,6 +29,7 @@ vhosts: {}
force_ssl: True
# install php-fpm, setup a php-handler upstream and copy a php location snippet to include in configs
# either "False", "True" or a dict *phpconfig*, see below for definition
php: False
```
@ -65,6 +66,9 @@ backend: None
# sets ssl certs to letsencrypt paths and enable letsencrypt for this vhost
letsencrypt: False
# Array of custom config strings to add to the vhost config, the ";" is added after every entry
custom: []
# array of locations, see below
locations: [*locationconfig*, .. ]
```
@ -78,3 +82,9 @@ match: ''
alias: None
```
**phpconfog**:
```
ini:
post_max_size: 64M
upload_max_filesize: 64M
```

View file

@ -49,10 +49,17 @@
notify:
- restart php-fpm
- set_fact:
phpinidefault:
post_max_size: 64M
upload_max_filesize: 64M
- set_fact:
phpini: "{{ phpinidefault|combine( {} if (nginx.php == True) else nginx.php.ini|d({}) ) }}"
- name: copy php-fpm php.ini
copy:
template:
dest: /etc/php/7.0/fpm/php.ini
src: php-fpm/php.ini
src: php-fpm/php.ini.j2
mode: 0644
notify:
- restart php-fpm

View file

@ -653,7 +653,7 @@ auto_globals_jit = On
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 8M
post_max_size = {{ phpini.post_max_size }}
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
@ -806,7 +806,7 @@ file_uploads = On
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M
upload_max_filesize = {{ phpini.upload_max_filesize }}
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

View file

@ -21,6 +21,11 @@ server {
add_header {{ header }} {{ vhost.add_headers[header] }};
{% endfor %}
{% for c in vhost.custom|default([]) %}
{{ c }};
{% endfor %}
{% if vhost.backend|default(False) %}
location / {
proxy_pass {{ vhost.backend }};