From 791832f6d104dc6a21dea4dfaf90f723fb2a54ef Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Sat, 5 Mar 2016 15:36:25 +0100 Subject: [PATCH] Config seems ok --- tasks/install_FreeBSD.yml | 11 +++++++++++ templates/etc/nginx/nginx.conf.j2 | 4 ++-- templates/etc/nginx/sites-available/_backuppc.j2 | 2 +- templates/etc/nginx/sites-available/_proxy.j2 | 2 +- tests/test.yml | 7 ++++--- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tasks/install_FreeBSD.yml b/tasks/install_FreeBSD.yml index 2083c5e..c6c30c6 100644 --- a/tasks/install_FreeBSD.yml +++ b/tasks/install_FreeBSD.yml @@ -13,3 +13,14 @@ - conf.d - sites-available - sites-enabled + +- name: FILE | Follow Debian ;) + file: > + src="{{ nginx_etc_dir }}/fastcgi_params" + dest="{{ nginx_etc_dir }}/fastcgi.conf" + state=link + +- name: COPY | Populate proxy_params + copy: > + content="proxy_set_header Host $http_host;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;" + dest="{{ nginx_etc_dir }}/proxy_params" diff --git a/templates/etc/nginx/nginx.conf.j2 b/templates/etc/nginx/nginx.conf.j2 index 060915d..4d21ebc 100644 --- a/templates/etc/nginx/nginx.conf.j2 +++ b/templates/etc/nginx/nginx.conf.j2 @@ -45,8 +45,8 @@ http { gzip_vary {{ nginx_http_gzip_vary }}; gzip_disable {{ nginx_http_gzip_disable }}; - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; + include {{ nginx_etc_dir }}/conf.d/*.conf; + include {{ nginx_etc_dir }}/sites-enabled/*; } # vim:filetype=nginx diff --git a/templates/etc/nginx/sites-available/_backuppc.j2 b/templates/etc/nginx/sites-available/_backuppc.j2 index c5bb887..9de6a8b 100644 --- a/templates/etc/nginx/sites-available/_backuppc.j2 +++ b/templates/etc/nginx/sites-available/_backuppc.j2 @@ -25,7 +25,7 @@ {% block template_upstream_location %} location ~ \.cgi$ { gzip off; - include /etc/nginx/fastcgi_params; + include {{ nginx_etc_dir }}/fastcgi_params; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_index BackupPC_Admin; fastcgi_param SCRIPT_FILENAME /usr/share/backuppc/cgi-bin$fastcgi_script_name; diff --git a/templates/etc/nginx/sites-available/_proxy.j2 b/templates/etc/nginx/sites-available/_proxy.j2 index 248fed5..724d31a 100644 --- a/templates/etc/nginx/sites-available/_proxy.j2 +++ b/templates/etc/nginx/sites-available/_proxy.j2 @@ -7,7 +7,7 @@ {% endblock %} {% block template_try_files %} - include /etc/nginx/proxy_params; + include {{ nginx_etc_dir }}/proxy_params; proxy_pass http://{{ item.upstream_name }}; {% if item.proxy_params is defined and item.proxy_params is iterable %} {% for param in item.proxy_params %} diff --git a/tests/test.yml b/tests/test.yml index 87e23b3..afdd1e9 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -149,8 +149,6 @@ location: '/hello': - htpasswd: 'hello' - - 'default_type "text/html; charset=UTF-8";' - - 'echo hello;' - name: 'test-htpasswd-all.local' template: '_base' htpasswd: 'hello' @@ -218,7 +216,10 @@ - name: -- Add HTML file -- copy: dest="{{ item }}/index.html" content="Index HTML test OK\n" with_items: ['{{ nginx_root }}/test.local/public', '/var/tmp', '{{ nginx_root }}/test-htpasswd-all.local/public', '{{ nginx_root }}/test-ssl.local/public', '{{ nginx_root }}/test-ssl-predeployed.local/public'] - + - name: -- Create directory -- + file: path={{ nginx_root }}/test-htpasswd-all.local/public/hello state=directory + - name: -- Add HTML file hello -- + copy: dest="{{ nginx_root }}/test-htpasswd-all.local/public/hello/index.html" content="hello\n" # -------------------------------- # Simple vhosts tests # --------------------------------