From 6dcde843199b104583872287f323f53461bcf69a Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 26 Jun 2021 02:53:44 +0200 Subject: [PATCH] Apache-Einrichtung des Aliases --- files/apache_site.conf | 34 ++++++++++++++++++++++++++++++++++ tasks/apache.yml | 6 ++++++ tasks/main.yml | 11 +++++++++++ templates/apache_alias.j2 | 1 + 4 files changed, 52 insertions(+) create mode 100644 files/apache_site.conf create mode 100644 templates/apache_alias.j2 diff --git a/files/apache_site.conf b/files/apache_site.conf new file mode 100644 index 0000000..af4bdca --- /dev/null +++ b/files/apache_site.conf @@ -0,0 +1,34 @@ + + + + ServerName $domain + DocumentRoot /data/nextcloud/$domain/ + Include /etc/apache2/conf-available/sao-cache.conf + IncludeOptional /etc/apache2/conf-available/$domain.alias.conf + + ProxyTimeout 900 + + + SetHandler "proxy:unix:/run/php/php-fpm-$pool.sock|fcgi://$domain/" + + + + + + + Require all granted + AllowOverride All + Options FollowSymLinks MultiViews + + Dav off + + + + + + + +# Includieren der Variablen +Include /etc/apache2/conf-available/nextcloud_sites.conf + +UndefMacro NCSite \ No newline at end of file diff --git a/tasks/apache.yml b/tasks/apache.yml index 1fa6520..02d3121 100644 --- a/tasks/apache.yml +++ b/tasks/apache.yml @@ -15,3 +15,9 @@ insertafter: "^Ansbile" line: "Use NCSite {{ instance.domain }} {{ instance.user }}" notify: reload apache + +- name: "apache: {{ instance.alias }}: Alias einrichten" + template: + src: apache_alias.j2 + dest: "/etc/apache2/conf-available/{{ instance.domain }}.alias.conf" + notify: reload apache diff --git a/tasks/main.yml b/tasks/main.yml index ee062ca..b3bfccc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,6 +26,11 @@ loop: "{{ instances }}" loop_control: loop_var: instance + +- name: "Apache: Vorlage für Seitenkonfiguration kopieren" + copy: + src: apache_site.conf + dest: /etc/apache/sites-available/nextcloud.conf - name: "Webserver einrichten" include_tasks: apache.yml @@ -33,6 +38,12 @@ loop_control: loop_var: instance +- name: "Apache: Seitenkonfiguration aktivieren" + file: + src: /etc/apache/sites-available/nextcloud.conf + dest: /etc/apache/sites-enabled/nextcloud.conf + state: link + - import_tasks: redis.yml - name: "Nextcloud einrichten" diff --git a/templates/apache_alias.j2 b/templates/apache_alias.j2 new file mode 100644 index 0000000..281460f --- /dev/null +++ b/templates/apache_alias.j2 @@ -0,0 +1 @@ +ServerAlias {{ instance.alias }} \ No newline at end of file