Merge pull request #125 from robbyoconnor/add-ipv6-support

Add ipv6 support
pull/213/merge
Jeff Geerling 3 years ago committed by GitHub
commit e533fbab36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 }};