# Difference between FASTCGI and PROXYing

**URL:** <https://www.ruby-forum.com/t/difference-between-fastcgi-and-proxying/209429>\
**Category:** NGINX\
**Created:** [July 13, 2011, 9:20pm UTC](https://www.ruby-forum.com/t/difference-between-fastcgi-and-proxying/209429 "2011-07-13T21:20:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 13, 2011, 9:20pm UTC](https://www.ruby-forum.com/t/difference-between-fastcgi-and-proxying/209429/1 "2011-07-13T21:20:43Z")

</div>

Hi there,

I have simple question regarding: what is the difference between these  
two load-balanced setups from performance perspective:

SETUP 1 - FASTCGI mode:  
Machine 1 - Load Balancer:  
NGinx as balancer is installed, Upstreaming is used to connect  
to the PHP-FPM servers below, using fastcgi\_pass directive;  
Machine 2 and 3: AppServers:  
PHP-FPM installed. No NGinx installation;  
HOW IT WORKS: Client request first comes to the Load balancer, it is  
redirected to AppServer using Upstreaming. Response is returned from  
AppServer to the LoadBalancer and to the client.

SETUP 2 - PROXY:  
Load Balancer:  
NGinx is installed, Upstreaming is used to redirect to the  
Machines below, using proxy\_pass directive;  
AppServers:  
NGinx is installed as web-server. It listens to the incoming  
calls from LoadBalancer via port 8000 and relays them to the PHP-FPM via  
port 9000 using fastcgi\_pass directive.  
PHP-FPM is installed as FCGI and listens to the local  
NGinx-web-server via port 9000. It accepts calls from it and returns the  
response to it.  
HOW IT WORKS: Client request first comes to LoadBalancer Nginx, and  
gets relayed to the NGinx@AppServer via Upstreaming, through port 8000.  
NGinx-web-server@AppServer receives the call from LoadBalancer and  
passes it via FCGI to its local PHP-FPM. PHP processes the request, and  
responds to the local app-server, which in return responds to the  
LoadBalancer. LoadBalancer answers the client’s request.

Thanks and sorry for long explanations…

Posted at Nginx Forum:

> **[Difference between FASTCGI and PROXYing](https://forum.nginx.org/read.php?2,212360,212360#msg-212360)**
>
> Hi there, I have simple question regarding: what is the difference between these two load-balanced setups from performance perspective: SETUP 1 - FASTCGI mode: Machine 1 - Load Balancer: NGinx as balancer is installed, Upstreaming is used to c
