mirror of
https://github.com/HanXHX/ansible-php.git
synced 2026-04-15 13:32:09 +07:00
Support FreeBSD 11/12
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
- name: SET_FACT | Prepare test vars
|
||||
set_fact:
|
||||
__nginx_site_dir: /etc/nginx/sites-enabled
|
||||
__nginx_conf: /etc/nginx/nginx.conf
|
||||
|
||||
- name: APT | Install packages
|
||||
apt:
|
||||
|
||||
13
tests/includes/pre_FreeBSD.yml
Normal file
13
tests/includes/pre_FreeBSD.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: SET_FACT | Prepare test vars
|
||||
set_fact:
|
||||
__nginx_conf: /usr/local/etc/nginx/nginx.conf
|
||||
php_xdebug_package: 'php72-pecl-xdebug26'
|
||||
|
||||
- name: PKGNG | Install packages
|
||||
pkgng:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- curl
|
||||
- nginx
|
||||
36
tests/templates/nginx.conf.j2
Normal file
36
tests/templates/nginx.conf.j2
Normal file
@@ -0,0 +1,36 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
user {{ php_default_user_group }};
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
server_name {{ vhost }};
|
||||
|
||||
root /var/www;
|
||||
|
||||
{% if php_fpm_poold.0.status_path is defined %}
|
||||
location = {{ php_fpm_poold.0.status_path }} {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
{% endif %}
|
||||
{% if php_fpm_poold.0.ping_path is defined %}
|
||||
location = {{ php_fpm_poold.0.ping_path }} {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
server {
|
||||
server_name {{ vhost }};
|
||||
|
||||
root /var/www;
|
||||
|
||||
{% if php_fpm_poold.0.status_path is defined %}
|
||||
location = {{ php_fpm_poold.0.status_path }} {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
{% endif %}
|
||||
{% if php_fpm_poold.0.ping_path is defined %}
|
||||
location = {{ php_fpm_poold.0.ping_path }} {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass unix:{{ php_default_fpm_sock }};
|
||||
}
|
||||
}
|
||||
@@ -31,14 +31,21 @@
|
||||
|
||||
- name: TEMPLATE | Nginx site config
|
||||
template:
|
||||
src: "templates/site.j2"
|
||||
dest: "{{ __nginx_site_dir }}/{{ vhost }}"
|
||||
src: "templates/nginx.conf.j2"
|
||||
dest: "{{ __nginx_conf }}"
|
||||
notify: reload nginx
|
||||
|
||||
- name: FILE | Delete default site
|
||||
file:
|
||||
path: "{{ __nginx_site_dir }}/default"
|
||||
state: absent
|
||||
- name: COMMAND | Fix nginx config
|
||||
command: "cp {{ __nginx_conf | dirname }}/fastcgi_params {{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||
args:
|
||||
creates: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||
notify: reload nginx
|
||||
|
||||
- name: LINEINFILE | Fix nginx config (second step)
|
||||
lineinfile:
|
||||
regexp: '^fastcgi_param\s+SCRIPT_FILENAME'
|
||||
line: "fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;"
|
||||
dest: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||
notify: reload nginx
|
||||
|
||||
handlers:
|
||||
|
||||
Reference in New Issue
Block a user