# Upstream module - using both fastcgi and http proxy - possible?

**URL:** <https://www.ruby-forum.com/t/upstream-module-using-both-fastcgi-and-http-proxy-possible/154183>\
**Category:** NGINX\
**Created:** [November 26, 2008, 8:26am UTC](https://www.ruby-forum.com/t/upstream-module-using-both-fastcgi-and-http-proxy-possible/154183 "2008-11-26T08:26:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@Imran](https://www.ruby-forum.com/u/Imran)\
**Post date:** [November 26, 2008, 8:26am UTC](https://www.ruby-forum.com/t/upstream-module-using-both-fastcgi-and-http-proxy-possible/154183/1 "2008-11-26T08:26:03Z")

</div>

Hello,

I am currently trying to setup a nginx setup like the following :

upstream backend {

server unix:/tmp/php.socket weight=10;  
server 10.0.0.200:8080 weight=2;

}

The first one is a FASTCGI + the second is a backend PHP proxy that I  
want to  
use so that if the main one is overloading the server, the backend can  
apply  
help reduce the load.

Is there any way this can be done ? I’m specifically also asking how I  
can  
configure the FASTCGI / mod\_Proxy parts.

Is my only option to run two NGINX- one for front end ( redirecting to a  
local  
nginx and a backend server as http proxy) , and the other doing fastcgi  
work ?

---

<div class="post-metadata">

**Author:** ![Imran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@Imran](https://www.ruby-forum.com/u/Imran)\
**Post date:** [November 26, 2008, 9:35am UTC](https://www.ruby-forum.com/t/upstream-module-using-both-fastcgi-and-http-proxy-possible/154183/2 "2008-11-26T09:35:45Z")

</div>

On Å›ro, lis 26, 2008 at 12:03:28 +0000, Imran wrote:

> Hello,
> 
> I am currently trying to setup a nginx setup like the following :
> 
> upstream backend {
> 
> server unix:/tmp/php.socket weight=10;  
> server 10.0.0.200:8080 weight=2;
> 
> }

This is a valid configuration snippet (AFAIK) but it won’t do what you  
probably expect. It defines two upstream servers, one running on a unix  
socket and one on TCP. The protocol that Nginx speaks to them depends on  
whether you use proxy\_pass or fastcgi\_pass. AFAIK you cannot balance  
between a FastCGI backend and a HTTP backend.

> The first one is a FASTCGI + the second is a backend PHP proxy that I want to  
> use so that if the main one is overloading the server, the backend can apply  
> help reduce the load.
> 
> Is there any way this can be done ? I’m specifically also asking how I can  
> configure the FASTCGI / mod\_Proxy parts.
> 
> Is my only option to run two NGINX- one for front end ( redirecting to a local  
> nginx and a backend server as http proxy) , and the other doing fastcgi work ?

You could also run the remote PHP over FastCGI and just use FastCGI  
everywhere. I think that php-fcgi -b 10.0.0.200:8080 or something  
similar will do the job (but I’m sure Mike will step in and tell you how  
to use php-fpm in such a setup ;))

Best regards,  
Grzegorz N.
