Welcome! Log In Create A New Profile

Advanced

Nginx config

Posted by hkcoolg 
Nginx config
December 04, 2012 05:00AM
Hi,
I'm new to this forum.
I'm using Nginx on CentOS6 and want to know if Nginx has functionality not to send requests to servers which are stopped or down for some reason.
For example: i have 3 apache servers configured and running. If i stop one or two of the apache server then Nginx should not send request to the stopped apache server.

Is this kind of setting can be done in Nginx? and what are the steps?

Your help will be much appreciated.

Thanks,
coolg
Re: Nginx config
December 04, 2012 11:58PM
Here's how i do it... connecting to php-fpm backends.

upstream backend {
ip_hash;
server unix:/var/run/php5-fpm.sock;
server 192.168.101.1:9000;
server 192.168.101.2:9000 down;
keepalive 8;
}

The addition of the down keyword ensures that sessions that can be honoured will still go to the valid servers.

I expect there will be something similar for proxy servers... don't use apache any more unless I can help it.
Re: Nginx config
December 05, 2012 04:57AM
Hi,
Thanks for your quick response.
But this way you are manually telling Nginx that one server is down -
server 192.168.101.2:9000 down;

Where as my requirement is that Nginx should automatically understand that one of the server is down and should not send request to it. Can this possible, if so then what changes needs to be done ?

Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready