Fixes #86 -- Add ipv6 support

pull/125/head
Robert O'Connor 7 years ago
parent d3baaf9908
commit 2aa9dd5f06
No known key found for this signature in database
GPG Key ID: 1DB67AA126AFFA8D
  1. 5
      README.md
  2. 4
      defaults/main.yml
  3. 6
      templates/vhost.j2

@ -16,6 +16,11 @@ None.
Available variables are listed below, along with default values (see `defaults/main.yml`):
nginx_listen_ipv6: true
Whether or not we want to listen on IPv6, this is enabled by default.
nginx_vhosts: []
A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry will create a separate config file named by `server_name`. If left empty, you will need to supply your own virtual host configuration. See the commented example in `defaults/main.yml` for available server options. If you have a large number of customizations required for your server definition(s), you're likely better off managing the vhost configuration file yourself, leaving this variable set to `[]`.

@ -57,6 +57,10 @@ nginx_extra_http_options: ""
# proxy_set_header Host $http_host;
nginx_remove_default_vhost: false
# Listen on IPv6 (default: true)
nginx_listen_ipv6: true
nginx_vhosts: []
# Example vhost below, showing all available options:
# - listen: "80" # default: "80"

@ -2,6 +2,9 @@
{% if item.server_name_redirect is defined %}
server {
listen {{ item.listen | default('80') }};
{% if nginx_listen_ipv6 %}
listen [::]:{{item.listen | default('80') }};
{% endif %}
server_name {{ item.server_name_redirect }};
return 301 $scheme://{{ item.server_name.split(' ')[0] }}$request_uri;
}
@ -13,6 +16,9 @@ server {
{% block server_basic -%}
listen {{ item.listen | default('80') }};
{% if nginx_listen_ipv6 %}
listen [::]:{{item.listen | default('80') }};
{% endif %}
{% if item.server_name is defined %}
server_name {{ item.server_name }};