Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 133f0c2

Browse files
committed
feat: use official Nginx Ansible module
1 parent 51b701d commit 133f0c2

File tree

3 files changed

+23
-147
lines changed

3 files changed

+23
-147
lines changed

ansible/requirements/requirements.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
version: v2.0.0
33
- name: robertdebock.python_pip
44
version: 3.3.0
5-
- name: geerlingguy.nginx
6-
version: 2.8.0
5+
- name: nginxinc.nginx
6+
version: 0.14.0
77
- name: geerlingguy.php
88
version: 4.4.0
99
- name: geerlingguy.php-versions

ansible/roles/stackhead_setup/tasks/setup-nginx.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,28 @@
55
dest: /etc/nginx
66
- name: Setup Nginx
77
vars:
8-
nginx_ppa_use: true
9-
nginx_conf_template: "{{ stackhead__templates }}/nginx.conf.j2"
10-
nginx_vhosts: []
11-
__nginx_user: "stackhead"
12-
root_group: "stackhead"
8+
nginx_main_template_enable: 1
9+
nginx_html_demo_template_enable: 1
10+
nginx_main_template:
11+
user: "stackhead"
12+
http_custom_options:
13+
# Add X-XSS-Protection for HTML documents. /etc/nginx/h5bp/security/x-xss-protection.conf
14+
- "map $sent_http_content_type $x_xss_protection {\n ~*text/html \"1; mode=block\";\n }"
15+
# Add X-Frame-Options for HTML documents. /etc/nginx/h5bp/security/x-frame-options.conf
16+
- "map $sent_http_content_type $x_frame_options {\n ~*text/html DENY;\n }"
17+
# Add Content-Security-Policy for HTML documents. /etc/nginx/h5bp/security/content-security-policy.conf
18+
- "map $sent_http_content_type $content_security_policy {\n ~*text/html \"default-src 'self'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests\";\n }"
19+
# Add Referrer-Policy for HTML documents. /etc/nginx/h5bp/security/referrer-policy.conf.conf
20+
- "map $sent_http_content_type $referrer_policy {\n ~*text/html \"strict-origin-when-cross-origin\";\n }"
21+
# Add X-UA-Compatible for HTML documents. /etc/nginx/h5bp/internet_explorer/x-ua-compatible.conf
22+
- "map $sent_http_content_type $x_ua_compatible {\n ~*text/html \"IE=edge\";\n }"
23+
# Add Access-Control-Allow-Origin. /etc/nginx/h5bp/cross-origin/requests.conf
24+
- "map $sent_http_content_type $cors {\n ~*image/ \"*\";\n ~*font/ \"*\";\n ~*application/vnd.ms-fontobject \"*\";\n ~*application/x-font-ttf \"*\";\n ~*application/font-woff \"*\";\n ~*application/x-font-woff \"*\";\n ~*application/font-woff2 \"*\";\n }"
25+
http_custom_includes:
26+
- /etc/nginx/h5bp/web_performance/compression.conf
27+
- /etc/nginx/h5bp/web_performance/cache_expiration.conf
1328
include_role:
14-
name: geerlingguy.nginx
29+
name: nginxinc.nginx
1530
- name: adjust owner of /var/www directories
1631
file:
1732
path: /var/www

ansible/templates/nginx.conf.j2

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)