0
votes

I have one FCGI process and its three instances are running on three different ports.

I am using nginx as reverse proxy server and now I want to use it for load balancing also. But I don't know how to configure it for fcgi processes.

I have configuration like this:

location /abc {  
    fastcgi_pass backend;
}

upstream backend {

} 

I can use the configuration mentioned in 2nd answer and it also works fine. https://serverfault.com/questions/598202/make-nginx-to-pass-hostname-of-the-upstream-when-reverseproxying

But I want to know how can I write fcgi process in upstream and how to pass some params to that fcgi process. Main problem is that I have to pass some variables coming through front-end request.

2

2 Answers

0
votes

Parameters are passed using the fastcgi_param directive. Use the PHP example as a template.

The upstream block should be populated with server statements. For example:

upstream backend {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

See this document for more.

0
votes

ngix does not start fcgi processes, you have to start them yourself. All parameters are passed by http HEADERS. if you need, for some reason, to identify each fcgi process you can use the port number.