bbc/nginx-upstream-dynamic-servers

Name: nginx-upstream-dynamic-servers

Owner: BBC

Description: An nginx module to resolve domain names inside upstreams and keep them up to date.

Forked from: GUI/nginx-upstream-dynamic-servers

Created: 2016-02-19 16:52:48.0

Updated: 2016-02-19 16:52:49.0

Pushed: 2015-11-23 21:10:29.0

Homepage: null

Size: 16

Language: Perl

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

nginx-upstream-dynamic-servers

An nginx module to resolve domain names inside upstreams and keep them up to date.

By default, servers defined in nginx upstreams are only resolved when nginx starts. This module provides an alternative dynamic_server directive that can be used to asyncronously resolve upstream domain names. This keeps the upstream definition up to date according to the DNS TTL of each domain names. This can be useful if you want to use upstreams for dynamic types of domain names that may frequently change IP addresses.

This module also allows nginx to start if an upstream contains a defunct domain name that no longer resolves. By default, nginx will fail to start if an upstream server contains an unresolvable domain name. With this module, nginx is still allowed to start with invalid domain names, but an error will be logged and the unresolvable domain names will be marked as down.

Installation
nfigure --add-module=/path/to/nginx-upstream-dynamic-servers
 && make install
Usage

Use the dynamic_server definition inside your upstreams instead of the built-in server (dyamic_server should be a drop-in replacement).

Note: A resolver must be defined at the http level of nginx's config for dynamic_server to work.

 {
solver 8.8.8.8;

stream example {
dynamic_server example.com;


Directives
dynamic_server

Syntax: dynamic_server address [parameters];
Context upstream

Defines a server for an upstream. The differences between the default server and dynamic_server implementation:

The following parameters can be used (see nginx's server documentation for details):

weight=number
max_fails=number
fail_timeout=time
backup
down

Compatibility

Tested with nginx 1.7.7.

Alternatives
License

nginx-upstream-dynamic-servers is open sourced under the MIT license.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.