blob: f059bfc080792f378183aaf9f6dcf56656142891 (
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
|
- name: Install Nginx
apt: pkg=nginx-light
- name: Limit Nginx logging
lineinfile: "dest=/etc/logrotate.d/nginx create=yes
regexp='^\\s*rotate\\s'
line='\trotate 7'"
tags:
- logrotate
- name: Copy fastcgi parameters and SSL configuration snippets
copy: src=etc/nginx/snippets/{{ item }}
dest=/etc/nginx/snippets/{{ item }}
owner=root group=root
mode=0644
register: r1
with_items:
- fastcgi.conf
- fastcgi-php.conf
- fastcgi-php-ssl.conf
- ssl.conf
- headers.conf
notify:
- Restart Nginx
- name: Copy /etc/nginx/sites-available/default
copy: src=etc/nginx/sites-available/default
dest=/etc/nginx/sites-available/default
owner=root group=root
mode=0644
register: r2
notify:
- Restart Nginx
- name: Create /etc/nginx/sites-enabled/default
file: src=../sites-available/default
dest=/etc/nginx/sites-enabled/default
owner=root group=root
state=link force=yes
register: r3
notify:
- Restart Nginx
- name: Add .asc to text/plain MIME types
lineinfile: dest=/etc/nginx/mime.types
regexp='^(\s*text/plain\s+)'
backrefs=yes
line='\1txt asc;'
register: r4
notify:
- Restart Nginx
# WARN Bullseye: nginx >=1.15.1 uses font/woff and font/woff2 (cf. https://trac.nginx.org/nginx/ticket/1243)
# however Bootstrap(?) appears to query resources with "Accept: application/font-woff" resp. application/font-woff2.
# Unfortunately it also uses "Accept-Encoding: identity" so the resource isn't compressed...
- name: Fix MIME type for woff
lineinfile: dest=/etc/nginx/mime.types
insertafter='^\s*\S+\s\s+woff;'
line=' application/font-woff2 woff2;'
register: r5
notify:
- Restart Nginx
- name: Start Nginx
service: name=nginx state=started
when: not (r1.changed or r2.changed or r3.changed or r4.changed or r5.changed)
- meta: flush_handlers
|