blob: 39e3fda54d6b4301e0e2c28bcb2a8268aa7c6d7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
- name: install apache2
ansible.builtin.package:
name: apache2
- name: enable mod_md
ansible.builtin.command:
cmd: a2enmod md
creates: /etc/apache2/mods-enabled/md.load
notify: restart web
- name: enable mod_ssl
ansible.builtin.command:
cmd: a2enmod ssl
creates: /etc/apache2/mods-enabled/ssl.load
notify: restart web
- name: enable mod_userdir
ansible.builtin.command:
cmd: a2enmod userdir
creates: /etc/apache2/mods-enabled/userdir.load
notify: restart web
- name: enable mod_proxy_http
ansible.builtin.command:
cmd: a2enmod proxy_http
creates: /etc/apache2/mods-enabled/proxy_http.load
notify: restart web
- name: enable mod_headers
ansible.builtin.command:
cmd: a2enmod headers
creates: /etc/apache2/mods-enabled/headers.load
notify: restart web
- name: enable mod_rewrite
ansible.builtin.command:
cmd: a2enmod rewrite
creates: /etc/apache2/mods-enabled/rewrite.load
notify: restart web
- name: ssl site
ansible.builtin.copy:
dest: /etc/apache2/sites-enabled/ssl.conf
content: |
{% if web_server_reachable %}
MDomain {{ public_hostname_punycode }}
MDCertificateAgreement accepted
{% endif %}
<VirtualHost {{ public_hostname_punycode }}:443>
ServerName {{ public_hostname_punycode }}
SSLEngine on
{% if not web_server_reachable %}
SSLCertificateFile "/etc/ssl/certs/ssl-cert-snakeoil.pem"
SSLCertificateKeyFile "/etc/ssl/private/ssl-cert-snakeoil.key"
{% endif %}
ServerAdmin {{ admin_email }}
<Location /vaultwarden/>
ProxyPass http://127.0.0.1:8080/vaultwarden/
ProxyPreserveHost On
RequestHeader set X-Real-IP %{REMOTE_ADDR}s
</Location>
RedirectMatch "^/$" "https://ñix.es/cgit/alex/ñix.es.git/about/"
RewriteEngine on
RewriteCond ${alexblog:$1} >""
RewriteMap alexblog "txt:/home/alex/public_html/redirections.txt"
RewriteRule "^/~alex/(.*)" "/~alex/${alexblog:$1}" [R=308,L]
</VirtualHost>
notify: restart web
- name: alex.corcoles.net
ansible.builtin.copy:
dest: /etc/apache2/sites-enabled/alex-corcoles-net.conf
content: |
{% if web_server_reachable %}
MDomain alex.corcoles.net
MDCertificateAgreement accepted
{% endif %}
<VirtualHost alex.corcoles.net:443>
ServerName alex.corcoles.net
SSLEngine on
{% if not web_server_reachable %}
SSLCertificateFile "/etc/ssl/certs/ssl-cert-snakeoil.pem"
SSLCertificateKeyFile "/etc/ssl/private/ssl-cert-snakeoil.key"
{% endif %}
ServerAdmin {{ admin_email }}
DocumentRoot /home/alex/public_html/
RewriteEngine on
RewriteCond ${alexblog:$1} >""
RewriteMap alexblog "txt:/home/alex/public_html/redirections.txt"
RewriteRule "^/(.*)" "/${alexblog:$1}" [R=308,L]
</VirtualHost>
notify: restart web
- name: gemini
ansible.builtin.copy:
dest: /etc/apache2/conf-enabled/gemini.conf
content: |
AddType text/gemini .gmi
AddCharset UTF-8 .gmi
# With the default dir module configuration disabled, DirectoryIndex index enables multiviews for indexes.
# This means that you can have index.html and index.gmi and the client and server will negotiate which content to deliver.
DirectoryIndex index
LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
notify: restart web
- name: rss
ansible.builtin.copy:
dest: /etc/apache2/conf-enabled/rss.conf
content: |
AddCharset UTF-8 .rss
notify: restart web
- name: disable dir mod
ansible.builtin.command:
cmd: a2dismod -f dir
removes: /etc/apache2/mods-enabled/dir.conf
notify: restart web
|