Improve apache configs, enable modules

This commit is contained in:
Salt 2020-02-05 22:28:03 -06:00
parent 6b0a86128d
commit 8906a0ea1e
2 changed files with 19 additions and 0 deletions

View File

@ -38,6 +38,11 @@
template: template:
src: apache2-vhost.conf src: apache2-vhost.conf
dest: "/etc/apache2/sites-enabled/{{ nextcloud_url }}.conf" dest: "/etc/apache2/sites-enabled/{{ nextcloud_url }}.conf"
- name: Disable default configuration
file:
# This is a symlink so who cares
path: "/etc/apache2/sites-enabled/000-default.conf"
state: absent
- name: Create webroot - name: Create webroot
file: file:
path: "{{ nextcloud_webroot }}" path: "{{ nextcloud_webroot }}"
@ -65,6 +70,11 @@
path: /var/www/nextcloud.tar.bz2 path: /var/www/nextcloud.tar.bz2
state: absent state: absent
when: not stat_webroot_index.stat.exists when: not stat_webroot_index.stat.exists
- name: Enable Apache configs and modules
shell: "{{ item }}"
loop:
- "ae2enmod rewrite"
- "ae2enmod ssl"
- name: Register certificates - name: Register certificates
block: block:
- name: Set up our filesystem heirarchy - name: Set up our filesystem heirarchy

View File

@ -11,12 +11,21 @@ SSLStrictSNIVHostCheck off
# Website configuration # Website configuration
<VirtualHost *:80> <VirtualHost *:80>
ServerName {{ nextcloud_url }} ServerName {{ nextcloud_url }}
# Uncomment me for HTTPS redirection
# Leaving it off for now for testing
#Redirect permanent / https://{{ nextcloud_url }}
DocumentRoot {{ nextcloud_webroot }} DocumentRoot {{ nextcloud_webroot }}
</VirtualHost> </VirtualHost>
<VirtualHost *:443> <VirtualHost *:443>
SSLEngine on SSLEngine on
SSLCertificateFile /etc/pki/cert/crt/{{ nextcloud_url }}.crt SSLCertificateFile /etc/pki/cert/crt/{{ nextcloud_url }}.crt
SSLCertificateKeyFile /etc/pki/cert/private/{{ nextcloud_url }}.key SSLCertificateKeyFile /etc/pki/cert/private/{{ nextcloud_url }}.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">\
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
ServerName {{ nextcloud_url }} ServerName {{ nextcloud_url }}
DocumentRoot {{ nextcloud_webroot }} DocumentRoot {{ nextcloud_webroot }}
</VirtualHost> </VirtualHost>