Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use fastcgi_next_upstream in Nginx [closed]

I'd like to have 1 web server (nginx) and 2 FastCGI instances of the same application as back-end. The idea is to forward requests to second one if the first one is down.

Apparently, I need to use upstream and fastcgi_next_upstream. But I could not find a working example of a nginx.conf file. Does anybody have such example?

like image 203
Julien Avatar asked Mar 29 '11 04:03

Julien


People also ask

What is Nginx FastCGI?

Definition of Nginx FastCGI. Nginx fastcgi is used to translate requests of clients from an application server which was not handled the request of the client directly. Nginx FastCGI is the protocol that was based on the CGI which is earlier or it will contain the gateway of a common interface.

What is Fail_timeout in nginx?

fail_timeout = time sets. the time during which the specified number of unsuccessful attempts to communicate with the server should happen to consider the server unavailable; and the period of time the server will be considered unavailable.

What is upstream address in nginx?

upstream defines a cluster that you can proxy requests to. It's commonly used for defining either a web server cluster for load balancing, or an app server cluster for routing / load balancing.

What is a FastCGI server?

FastCGI is a fast, open, and secure Web server interface that solves the performance problems inherent in CGI, without introducing the overhead and complexity of proprietary APIs (Application Programming Interfaces).


1 Answers

http://wiki.nginx.org/HttpUpstreamModule
http://wiki.nginx.org/HttpFcgiModule

upstream  backend  {
    server   main_backend.server:port1;
    server   backup.server:port2    backup;
}

fastcgi_pass backend;
like image 75
CyberDem0n Avatar answered Sep 22 '22 19:09

CyberDem0n