Skip to content
Snippets Groups Projects
Commit a9c14d7a authored by jurgenhaas's avatar jurgenhaas
Browse files

Optional HTTP Basic auth for discourse

parent c2d36d0e
No related branches found
No related tags found
No related merge requests found
......@@ -15,3 +15,16 @@
command: a2ensite discourse creates=/etc/apache2/sites-enabled/discourse{{ apache_conf_ext }}
notify:
- "Apache | Restart Apache"
- block:
- name: "Setup AuthType Basic"
htpasswd:
path: '/var/discourse/containers/passwords'
name: '{{ discourse_apache_auth.user }}'
password: '{{ discourse_apache_auth.password }}'
owner: 'root'
group: 'root'
mode: '664'
when: discourse_apache_auth is defined
---
# file: roles/discourse/tasks/install.yml
- name: "Configure Apache"
include_tasks: apache.yml
tags: 'always'
- name: "Clone Repository"
git:
accept_hostkey: yes
......@@ -26,3 +22,7 @@
shell: '/var/discourse/launcher rebuild app'
when: discourse_repository.changed
- name: "Configure Apache"
include_tasks: apache.yml
tags: 'always'
......@@ -40,9 +40,16 @@
AllowEncodedSlashes NoDecode
<Location />
Require all granted
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://{{ discourse_domain }}/
{% if discourse_apache_auth is defined %}
AuthType {{ discourse_apache_auth.type }}
AuthName "{{ discourse_apache_auth.name }}"
AuthUserFile /var/discourse/containers/passwords
Require {{ discourse_apache_auth.user }} {{ discourse_apache_auth.password }}
{% else %}
Require all granted
{% endif %}
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://{{ discourse_domain }}/
</Location>
RewriteEngine on
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment