Hi Martin Did you try the try_files directive: http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files ? Sounds like it does what you want.
Cheers On Tue, 21 Jun 2016, 13:37 Martin Harris, <[email protected]> wrote: > Hi Folks, > > We've been making some additions to the Brooklyn documentation [here]( > https://github.com/apache/brooklyn-docs/pull/78) and [here]( > https://github.com/apache/brooklyn-docs/pull/79), and as part of it I was > attempting to setup an nginx controller to act as a reverse proxy to a HA > Brooklyn cluster > > The idea is pretty simple: > > [image: Inline images 1] > > The nginx serves as a single front-end to the HA cluster and directs all > traffic to the Brooklyn master server. The Brooklyn master and slave server > share a single shared persisted state (standard HA configuration using S3 > or NFS) > > On the event of a failure of the master node, the slave node would promote > itself to master, and the nginx controller would now direct all traffic to > the slave server. If the original master were to be restarted, it would > restart as a slave and would be available in the event of failure of the > new master server > > Unfortunately, I've been unable to configure nginx to do what we need. > I've got as far as [this configuration file]( > https://gist.github.com/nakomis/b216e877bcea206a3c5ad782c195df9c), but in > this configuration, once it has failed over to the slave, it's not possible > to restart the master server as the new slave > > If I remove the max_fails and backup directives on lines 7 & 8 in the > config above, nginx simply performs a round-robin across the two nodes > > Is there a way to configure nginx to fail over from the master to the > slave (or preferably find the new master)? > > Any help would be appreciated > > Cheers > > M > > > -- > Martin Harris > Lead Software Engineer > Cloudsoft Corporation Ltd > www.cloudsoftcorp.com > > -- Thomas Bouron • Software Engineer @ Cloudsoft Corporation • http://www.cloudsoftcorp.com/ Github: https://github.com/tbouron Twitter: https://twitter.com/eltibouron
