Skip to content

Commit 9c3dcb4

Browse files
committed
Update mainstream
2 parents c5de700 + e92e632 commit 9c3dcb4

File tree

5 files changed

+41
-13
lines changed

5 files changed

+41
-13
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ The following variables are available to configure the role:
7474
servers, defaults to ```["unix:/var/run/php-fpm-bkp.sock"]```.
7575
- **nginx_drupal_language_path_prefixes**: (optional) The list of enabled
7676
language path prefixes used on the site.
77+
- **nginx_drupal_x_frame_options**: (optional) Value of the X-Frame-Options
78+
response header, defaults to `DENY`. If the site uses frames, set to
79+
`SAMEORIGIN`. `DENY` may conflicts with pseudo streaming (at least with Nginx
80+
version 1.0.12)
7781
- **nginx_drupal_sites**: The list of available sites.
7882
Each site uses the following structure:
7983
- **file_name**: The name of the site configuration file.
@@ -94,10 +98,11 @@ The following variables are available to configure the role:
9498
- **limit_conn**: (optional) The limit_conn for the site (defaults to
9599
```arbeit 32```).
96100
- **enabled**: Whether or not the site should be enabled (defaults to true).
97-
* **rewrites**: A list of rewrites directives, using the following structure:
101+
- **rewrites**: (optional) A list of rewrites directives, using the following structure:
98102
- **regex**: The regular expression used to match the URI.
99103
- **replacement**: The replacement pattern used for the rewrite.
100-
- **flags**: (optiona) The flag parameter for the rewrite.
104+
- **flags**: (optional) The flag parameter for the rewrite.
105+
- **includes**: (optional) A list of additional Nginx configuration files to incldue for the site.
101106

102107

103108
Examples

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ nginx_drupal_sites: none
3030
nginx_drupal_http_pre_includes: []
3131
nginx_drupal_http_post_includes: []
3232
nginx_drupal_language_path_prefixes: []
33-
nginx_drupal_xframe_options: "SAMEORIGIN"
33+
nginx_drupal_x_frame_options: DENY

templates/apps/drupal/drupal.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,9 @@ location @empty {
396396
## Any other attempt to access PHP files returns a 404.
397397
location ~* ^.+\.php$ {
398398
return 404;
399-
}
399+
}
400+
401+
## Add support for custom monitoring script.
402+
location = /monitor/index.php {
403+
fastcgi_pass phpcgi;
404+
}

templates/nginx.j2

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,13 @@ http {
160160
## https://www.owasp.org/index.php/List_of_useful_HTTP_headers.
161161
add_header X-XSS-Protection '1; mode=block';
162162

163+
{% if nginx_drupal_x_frame_options %}
163164
## Enable clickjacking protection in modern browsers. Available in
164165
## IE8 also. See
165166
## https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
166167
## This may conflicts with pseudo streaming (at least with Nginx version 1.0.12).
167-
## Uncomment the line below if you're not using media streaming.
168-
## For sites being framing on the same domqin uncomment the line below.
169-
#add_header X-Frame-Options SAMEORIGIN;
170-
## For sites accepting to be framed in any context comment the
171-
## line below.
172-
add_header X-Frame-Options {{nginx_drupal_xframe_options}};
168+
add_header X-Frame-Options {{ nginx_drupal_x_frame_options }};
169+
{% endif %}
173170

174171
## Block MIME type sniffing on IE.
175172
add_header X-Content-Options nosniff;

templates/sites-available/drupal-site.j2

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,20 @@ server {
6060
proxy_http_version 1.1; # keep alive to the Apache upstream
6161
{% endif %}
6262

63-
{% if item.rewrites is defined -%}
64-
{% for rewrite in item.rewrites -%}
63+
{% if item.rewrites is defined %}
6564
## URL rewriting
65+
{% for rewrite in item.rewrites %}
6666
rewrite {{rewrite.regex}} {{rewrite.replacement}} {{rewrite.flags|default('')}};
67-
{%- endfor %}
67+
{% endfor %}
6868
{%- endif %}
6969

70+
{% if item.includes is defined %}
71+
## Custom include(s)
72+
{% for include in item.includes %}
73+
include {{ include }};
74+
{% endfor %}
75+
{% endif %}
76+
7077

7178
{% if not nginx_drupal_use_boost -%}
7279
{% if not nginx_drupal_escape_uri -%}
@@ -238,6 +245,20 @@ server {
238245
return 405;
239246
}
240247

248+
{% if item.rewrites is defined %}
249+
## URL rewriting
250+
{% for rewrite in item.rewrites %}
251+
rewrite {{rewrite.regex}} {{rewrite.replacement}} {{rewrite.flags|default('')}};
252+
{% endfor %}
253+
{%- endif %}
254+
255+
{% if item.includes is defined %}
256+
## Custom include(s)
257+
{% for include in item.includes %}
258+
include {{ include }};
259+
{% endfor %}
260+
{% endif %}
261+
241262
{% if not nginx_drupal_use_boost -%}
242263
{% if not nginx_drupal_escape_uri -%}
243264
################################################################

0 commit comments

Comments
 (0)