Welcome! Log In Create A New Profile

Advanced

Upstream Fallback if Backends can´t be reached

December 15, 2011 11:10AM
Hi Forum, i´m new to nginx and trying to realize the following. I want to Loadbalance two Backends and have nginx to be the ssl Proxy. That works so far.
I want nginx to rewrite a particular url to something else. That works too.
But now i want to send the Clients to a maintenance site, if both Backends fail, and i´m fighting like crazy here, but can´t get it to work. Maybe you can give me some advice, here is me config:

user nginx;
worker_processes 1;

#error_log logs/error.log;
error_log logs/error.log notice;
#error_log logs/error.log info;

pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
upstream online {
healthcheck_enabled;
healthcheck_delay 5000;
healthcheck_timeout 5000;
healthcheck_failcount 1;
server 10.194.1.10:8080 max_fails=2 fail_timeout=2s weight=2;
server 10.194.1.108:8080 max_fails=2 fail_timeout=2s weight=2;
server 10.194.100.50:8080 weight=5; ##Fallback
sticky;
ip_hash;
}
upstream org {
healthcheck_enabled;
healthcheck_delay 5000;
healthcheck_timeout 5000;
healthcheck_failcount 1;
server 10.194.1.107:8090 max_fails=2 fail_timeout=2s weight=2;
server 10.194.1.108:8090 max_fails=2 fail_timeout=2s weight=2;
server 10.194.100.50:8080 weight=5; ##Fallback
sticky;
ip_hash;
}
gzip on;
server {
listen 10.194.100.50:8080;
server_tokens off;
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
index index.html;
root /var/www;
rewrite ^ http://10.194.100.50:8080/index.html;
}
server {
listen 10.194.100.50:80;
server_name www.example.de;
rewrite ^ http://www.example.de/de/examples/example.php?thisID=44 permanent;
}
server {
ssl on;
ssl_prefer_server_ciphers on;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!SSLv2:!ADH:!aNULL:!eNULL:!NULL;
listen 10.194.100.50:443 ssl;
ssl_certificate ssl/nginx-test.crt;
ssl_certificate_key ssl/nginx-test.key;
keepalive_timeout 60;
server_tokens off;
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
server_name org;
location /org {
proxy_pass http://org;
}
server_name online;
location /online {
proxy_pass http://online;
}
}
}
Subject Author Posted

Upstream Fallback if Backends can´t be reached

kperas December 15, 2011 11:10AM

Re: Upstream Fallback if Backends can´t be reached

Brian Akins December 15, 2011 07:30PM

Re: Upstream Fallback if Backends can´t be reached

kperas December 16, 2011 02:19AM

Re: Upstream Fallback if Backends can´t be reached

kperas December 16, 2011 08:02AM

Re: Upstream Fallback if Backends can´t be reached

kperas December 16, 2011 08:03AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready