Skip to content

Commit 85ae200

Browse files
author
Aurelien Bondis
committed
configure nginx real_ip and allow fcgi_index
1 parent 4f6f55a commit 85ae200

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The following variables are available to configure the role:
7575
servers, defaults to ```["unix:/var/run/php-fpm-bkp.sock"]```.
7676
- **nginx_drupal_language_path_prefixes**: (optional) The list of enabled
7777
language path prefixes used on the site.
78+
- **nginx_drupal_set_real_ip_from**: (optional) configure real_ip if necessary
7879
- **nginx_drupal_x_frame_options**: (optional) Value of the X-Frame-Options
7980
response header, defaults to `DENY`. If the site uses frames, set to
8081
`SAMEORIGIN`. `DENY` may conflicts with pseudo streaming (at least with Nginx
@@ -111,6 +112,7 @@ The following variables are available to configure the role:
111112
- **allowed_ips**: (optional) List of IP (with or without subnet) allowed to visit this location
112113
- **denied_ips**: (optional) List of IP (with or without subnet) denied to visit this location
113114
- **fastcgi_pass**: (optional) fastcgi socket (or IP) to send to. If not specified, will use the @drupal location as upstream.
115+
- **fastcgi_index**: (optional) fastcgi index
114116
- **includes**: (optional) A list of additional Nginx configuration files
115117
to include for the site.
116118
- **server_name_in_redirect**: (optional) Enables or disables the use of

templates/nginx.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ http {
3939
## static file serving.
4040
sendfile on;
4141
## Handling of IPs in proxied and load balancing situations.
42+
{% if nginx_drupal_set_real_ip_from is defined %}
43+
set_real_ip_from {{ nginx_drupal_set_real_ip_from }};
44+
{% else %}
4245
set_real_ip_from 0.0.0.0/32; # all addresses get a real IP.
46+
{% endif %}
4347
real_ip_header X-Forwarded-For; # the ip is forwarded from the load balancer/proxy
4448

4549
## Define a zone for limiting the number of simultaneous

templates/sites-available/drupal-site.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ server {
9696
{%- if location.fastcgi_pass is defined -%}
9797
include fastcgi_params;
9898
fastcgi_pass {{ location.fastcgi_pass }};
99+
{%- if location.fastcgi_index is defined -%}
100+
fastcgi_index {{ location.fastcgi_index }};
101+
{% endif %}
99102
{% else %}
100103
try_files $uri @drupal;
101104
{% endif %}
@@ -309,6 +312,9 @@ server {
309312
{% if location.fastcgi_pass is defined %}
310313
include fastcgi_params;
311314
fastcgi_pass {{ location.fastcgi_pass }};
315+
{%- if location.fastcgi_index is defined -%}
316+
fastcgi_index {{ location.fastcgi_index }};
317+
{% endif %}
312318
{% else %}
313319
try_files $uri @drupal;
314320
{% endif %}

0 commit comments

Comments
 (0)