From c703a4fba8f97d60a50d707e88e545efdab0af24 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Wed, 23 Dec 2015 17:37:58 +0100 Subject: [PATCH] Support BackupPC --- README.md | 1 + .../etc/nginx/sites-available/_backuppc.j2 | 33 +++++++++++++++++++ tests/test.yml | 10 ++++++ 3 files changed, 44 insertions(+) create mode 100644 templates/etc/nginx/sites-available/_backuppc.j2 diff --git a/README.md b/README.md index ac14222..7738106 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ You can see many examples in: [tests/test.yml](tests/test.yml). #### Templates - `_base`: static template + - `_backuppc`: access to [BackupPC](http://backuppc.sourceforge.net/) (be careful: you need to install [fcgiwrap](https://packages.debian.org/jessie/fcgiwrap)) - `_dokuwiki` - `_redirect`: should not be called explicitly - `_phalcon`: Phalcon PHP Framework diff --git a/templates/etc/nginx/sites-available/_backuppc.j2 b/templates/etc/nginx/sites-available/_backuppc.j2 new file mode 100644 index 0000000..5caf3f1 --- /dev/null +++ b/templates/etc/nginx/sites-available/_backuppc.j2 @@ -0,0 +1,33 @@ +{% extends "_base.j2" %} + +{% block root %} + root /usr/share/backuppc/cgi-bin; +{% endblock %} + +{% block template_try_files %} +{% endblock %} + +{% block template_index %} + index index.cgi; +{% endblock %} + +{% block template_local_content %} + location ~ /\.ht { + deny all; + } + + location /backuppc/image { + alias /usr/share/backuppc/image; + expires 60d; + } +{% endblock %} + +{% block template_upstream_location %} + location ~ \.cgi$ { + gzip off; + include /etc/nginx/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; + } +{% endblock %} diff --git a/tests/test.yml b/tests/test.yml index e2026cd..06f95c5 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -6,6 +6,7 @@ with_items: - php5-fpm - curl + - fcgiwrap vars: nginx_php: true nginx_upstreams: @@ -77,9 +78,13 @@ delete: true - name: 'redirect-to.local' redirect_to: 'http://test.local' + - name: 'backuppc.local' + template: '_backuppc' + htpasswd: 'hello' roles: - ../../ post_tasks: + - apt: pkg=backuppc state=present - name: -- Add PHP file -- copy: dest="{{ nginx_root }}/{{ item }}/public/index.php" content="