Skip to content

Commit 63f7bcc

Browse files
author
Pierre Buyle
committed
Support server_name_in_redirect directive.
1 parent abbb0f7 commit 63f7bcc

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ The following variables are available to configure the role:
6161
(cf. http://wiki.nginx.org/HttpFlvStreamModule), defaults to false.
6262
- **nginx_drupal_mp4_streaming**: Whether or not to use MP4 streaming, (cf.
6363
http://nginx.org/en/docs/http/ngx_http_mp4_module.html) defaults to false.
64-
- **nginx_drupal_http_pre_includes**: A list of file to include in the ```http```
65-
context (in ```nginx.conf```), before any other directives.
66-
- **nginx_drupal_http_post_includes**: A list of file to include in the ```http```
67-
context (in ```nginx.conf```), after any other directives except the enabled
64+
- **nginx_drupal_http_pre_includes**: A list of file to include in the
65+
```http``` context (in ```nginx.conf```), before any other directives.
66+
- **nginx_drupal_http_post_includes**: A list of file to include in the
67+
```http``` context (in ```nginx.conf```), after any other directives except
68+
the enabled
6869
site configuration files.
69-
- **nginx_drupal_upstream_servers**: The list of PHP upstream servers, each item
70-
is a server address (and parameters, see
70+
- **nginx_drupal_upstream_servers**: The list of PHP upstream servers, each
71+
item is a server address (and parameters, see
7172
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server), defaults
7273
to ```["unix:/var/run/php-fpm.sock", "php-fpm-zwei.sock"]```.
7374
- **nginx_drupal_upstream_backup_servers**: The list of PHP upstream backup
@@ -85,24 +86,29 @@ The following variables are available to configure the role:
8586
- **port**: The port to listen on
8687
- **https**: HTTPS server configuration (leave empty to disable HTTPS)
8788
- **port**: The port to listen on.
88-
- **certificate**: Path to the SSL certificate of the server (in the PEM
89-
format).
89+
- **certificate**: Path to the SSL certificate of the server (in the
90+
PEM format).
9091
- **certificate_key**: Path to the SSL secret key of the server (in the
9192
PEM format).
9293
- **server_name**: The (primary) server name.
9394
- **ipv6**: (optional) IPv6 address of the server
94-
- **alternate_server_name**: (optional) Alternate server name, configured as
95-
redirect to the primary server site. This can be used to remove the
95+
- **alternate_server_name**: (optional) Alternate server name, configured
96+
as redirect to the primary server site. This can be used to remove the
9697
```www.``` prefix.
9798
- **root**: Path to the root directory for the site.
9899
- **limit_conn**: (optional) The limit_conn for the site (defaults to
99100
```arbeit 32```).
100101
- **enabled**: Whether or not the site should be enabled (defaults to true).
101-
- **rewrites**: (optional) A list of rewrites directives, using the following structure:
102+
- **rewrites**: (optional) A list of rewrites directives, using the
103+
following structure:
102104
- **regex**: The regular expression used to match the URI.
103105
- **replacement**: The replacement pattern used for the rewrite.
104106
- **flags**: (optional) The flag parameter for the rewrite.
105-
- **includes**: (optional) A list of additional Nginx configuration files to incldue for the site.
107+
- **includes**: (optional) A list of additional Nginx configuration files
108+
to include for the site.
109+
- **server_name_in_redirect**: (optional) Enables or disables the use of
110+
the primary server name, specified by the server_name directive, in
111+
redirects issued by nginx.
106112

107113

108114
Examples

templates/sites-available/drupal-site.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ server {
6262
proxy_http_version 1.1; # keep alive to the Apache upstream
6363
{% endif %}
6464

65+
server_name_in_redirect {{'on' if item.server_name_in_redirect|default(false) else 'off'}};
66+
6567
{% if item.rewrites is defined %}
6668
## URL rewriting
6769
{% for rewrite in item.rewrites %}
@@ -249,6 +251,8 @@ server {
249251
return 405;
250252
}
251253

254+
server_name_in_redirect {{'on' if item.server_name_in_redirect|default(false) else 'off'}};
255+
252256
{% if item.rewrites is defined %}
253257
## URL rewriting
254258
{% for rewrite in item.rewrites %}

0 commit comments

Comments
 (0)