Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit f25143a

Browse files
committed
feat: use official Nginx Ansible module
1 parent 39e1e2d commit f25143a

File tree

3 files changed

+22
-147
lines changed

3 files changed

+22
-147
lines changed

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ galaxy_info:
1313
- nginx
1414

1515
dependencies:
16-
- role: geerlingguy.nginx
16+
- role: nginxinc.nginx

tasks/setup.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,30 @@
44
synchronize:
55
src: "{{ role_path }}/vendor/server-configs-nginx/h5bp"
66
dest: /etc/nginx
7-
- set_fact:
8-
nginx_conf_template: "{{ role_path }}/templates/nginx/nginx.conf.j2"
97
- name: Setup Nginx
108
vars:
11-
nginx_ppa_use: true
12-
nginx_vhosts: []
13-
__nginx_user: "stackhead"
14-
root_group: "stackhead"
9+
nginx_main_template_enable: 1
10+
nginx_html_demo_template_enable: 1
11+
nginx_main_template:
12+
user: "stackhead"
13+
http_custom_options:
14+
# Add X-XSS-Protection for HTML documents. /etc/nginx/h5bp/security/x-xss-protection.conf
15+
- "map $sent_http_content_type $x_xss_protection {\n ~*text/html \"1; mode=block\";\n }"
16+
# Add X-Frame-Options for HTML documents. /etc/nginx/h5bp/security/x-frame-options.conf
17+
- "map $sent_http_content_type $x_frame_options {\n ~*text/html DENY;\n }"
18+
# Add Content-Security-Policy for HTML documents. /etc/nginx/h5bp/security/content-security-policy.conf
19+
- "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 }"
20+
# Add Referrer-Policy for HTML documents. /etc/nginx/h5bp/security/referrer-policy.conf.conf
21+
- "map $sent_http_content_type $referrer_policy {\n ~*text/html \"strict-origin-when-cross-origin\";\n }"
22+
# Add X-UA-Compatible for HTML documents. /etc/nginx/h5bp/internet_explorer/x-ua-compatible.conf
23+
- "map $sent_http_content_type $x_ua_compatible {\n ~*text/html \"IE=edge\";\n }"
24+
# Add Access-Control-Allow-Origin. /etc/nginx/h5bp/cross-origin/requests.conf
25+
- "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 }"
26+
http_custom_includes:
27+
- /etc/nginx/h5bp/web_performance/compression.conf
28+
- /etc/nginx/h5bp/web_performance/cache_expiration.conf
1529
include_role:
16-
name: geerlingguy.nginx
30+
name: nginxinc.nginx
1731
- name: adjust owner of /var/www directories
1832
file:
1933
path: /var/www

templates/nginx/nginx.conf.j2

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

0 commit comments

Comments
 (0)