diff options
| author | 2024-09-02 03:38:25 +0100 | |
|---|---|---|
| committer | 2024-09-02 13:21:15 +0200 | |
| commit | 091e10560847e793ce14a36a39a40554eea92144 (patch) | |
| tree | a9cf70b81009e933f796fe5e49bb13994ac1db0a /ansible/roles | |
| parent | Raise time threshold for 4xx alerts (diff) | |
Treat NGINX responses as UTF-8
Some sites that had non-ASCII characters rendered weirdly because our
NGINX configuration was not returning a default charset and so rendering
was being left up to browser/standards defaults.
This change adds a new config file to /etc/nginx/conf.d/ which forces
responses to be interpreted as/transformed to UTF-8.
Diffstat (limited to 'ansible/roles')
| -rw-r--r-- | ansible/roles/nginx/tasks/main.yml | 17 | ||||
| -rw-r--r-- | ansible/roles/nginx/templates/nginx-conf.d/charset.conf.j2 | 2 | 
2 files changed, 19 insertions, 0 deletions
| diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/nginx/tasks/main.yml index 37d2793..e6060f1 100644 --- a/ansible/roles/nginx/tasks/main.yml +++ b/ansible/roles/nginx/tasks/main.yml @@ -25,6 +25,23 @@    file:      path: /etc/nginx/sites-enabled/default      state: absent +  tags: +    - role::nginx + +- name: Copy conf.d entries +  template: +    src: "{{ item }}" +    dest: "/etc/nginx/conf.d/{{ item | basename | splitext | first }}" +    mode: "0444" +    owner: root +    group: root +  with_fileglob: "../templates/nginx-conf.d/*" +  loop_control: +    label: "{{ item | basename | splitext | first }}" +  tags: +    - role::nginx +  notify: +    - Reload the nginx service  - name: Copy host-specific configs    copy: diff --git a/ansible/roles/nginx/templates/nginx-conf.d/charset.conf.j2 b/ansible/roles/nginx/templates/nginx-conf.d/charset.conf.j2 new file mode 100644 index 0000000..d0db21e --- /dev/null +++ b/ansible/roles/nginx/templates/nginx-conf.d/charset.conf.j2 @@ -0,0 +1,2 @@ +# {{ ansible_managed }} +charset utf-8; | 
