Apache-Einrichtung des Aliases

This commit is contained in:
phil 2021-06-26 02:53:44 +02:00
parent 2b518c2b2c
commit 6dcde84319
4 changed files with 52 additions and 0 deletions

34
files/apache_site.conf Normal file
View file

@ -0,0 +1,34 @@
<Macro NCSite $domain $pool>
<VirtualHost *:80>
ServerName $domain
DocumentRoot /data/nextcloud/$domain/
Include /etc/apache2/conf-available/sao-cache.conf
IncludeOptional /etc/apache2/conf-available/$domain.alias.conf
ProxyTimeout 900
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php-fpm-$pool.sock|fcgi://$domain/"
</FilesMatch>
<Proxy "fcgi://$domain/">
</Proxy>
<Directory /data/nextcloud/$domain/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
</Macro>
# Includieren der Variablen
Include /etc/apache2/conf-available/nextcloud_sites.conf
UndefMacro NCSite

View file

@ -15,3 +15,9 @@
insertafter: "^Ansbile" insertafter: "^Ansbile"
line: "Use NCSite {{ instance.domain }} {{ instance.user }}" line: "Use NCSite {{ instance.domain }} {{ instance.user }}"
notify: reload apache 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

View file

@ -27,12 +27,23 @@
loop_control: loop_control:
loop_var: instance 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" - name: "Webserver einrichten"
include_tasks: apache.yml include_tasks: apache.yml
loop: "{{ instances }}" loop: "{{ instances }}"
loop_control: loop_control:
loop_var: instance 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 - import_tasks: redis.yml
- name: "Nextcloud einrichten" - name: "Nextcloud einrichten"

View file

@ -0,0 +1 @@
ServerAlias {{ instance.alias }}