mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-09-20 03:00:59 +02:00
Fixes #86 -- Add ipv6 support
This commit is contained in:
parent
d3baaf9908
commit
2aa9dd5f06
@ -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 }};
|
||||
|
Loading…
Reference in New Issue
Block a user