Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding resolver #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@
# multi_accept tries to accept() as many connections as possible after nginx
# gets notification about a new connection.
default[:nginx][:multi_accept] = "off"

#
# Configures name servers used to resolve names of upstream servers into addresses, for example:
# resolver 127.0.0.1 [::1]:5353;
# An address can be specified as a domain name or IP address, and an optional port (1.3.1, 1.2.2).
# If port is not specified, the port 53 is used. Name servers are queried in a round-robin fashion.
# By default, nginx will look up both IPv4 and IPv6 addresses while resolving. If looking up of IPv6 addresses is not desired,
# the ipv6=off parameter can be specified.
# Resolving of names into IPv6 addresses is supported starting from version 1.5.8.
# By default, nginx caches answers using the TTL value of a response. An optional valid parameter allows overriding it:
# resolver 127.0.0.1 [::1]:5353 valid=30s;
default[:nginx][:resolver] = nil

# Before version 1.1.9, tuning of caching time was not possible, and nginx always cached answers for the duration of 5 minutes.
# Syntax: resolver_timeout time;
# Default:
# resolver_timeout 30s;
# Context: http, server, location
# Sets a timeout for name resolution, for example:
# resolver_timeout 5s;
default[:nginx][:resolver_timeout] = '30s'

#
# Directive activate or deactivate the usage of sendfile().
# sendfile() copies data between one file descriptor and another. Because this
Expand Down
8 changes: 8 additions & 0 deletions templates/default/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ http {
tcp_nopush <%= node[:nginx][:tcp_nopush] %>;
tcp_nodelay <%= node[:nginx][:tcp_nodelay] %>;

<%- unless node[:nginx][:resolver].nil? -%>
##
# Resolver Settings
##
resolver <%= node[:nginx][:resolver] %>;
resolver_timeout <%= node[:nginx][:resolver_timeout] %>;
<%- end -%>

##
# Timeouts
##
Expand Down