# FastCGI in various servers

**URL:** <https://www.ruby-forum.com/t/fastcgi-in-various-servers/200565>\
**Category:** NGINX\
**Created:** [December 15, 2010, 10:02pm UTC](https://www.ruby-forum.com/t/fastcgi-in-various-servers/200565 "2010-12-15T22:02:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 15, 2010, 10:02pm UTC](https://www.ruby-forum.com/t/fastcgi-in-various-servers/200565/1 "2010-12-15T22:02:27Z")

</div>

Hello,

I have a question about fastcgi. If I use 5 web server with fastcgi,  
with a script that works with session variables, if it balances the  
request to another different server. How to access the session  
variables? As will be stored in another /tmp/SESSION\_XXX (other  
machine).

I can use in nginx fastcgi servers located on another machine, some  
configuration examples?. Thanks.

Regards,  
Anthony.

---

<div class="post-metadata">

**Author:** ![antonio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@antonio](https://www.ruby-forum.com/u/antonio)\
**Post date:** [December 15, 2010, 11:36pm UTC](https://www.ruby-forum.com/t/fastcgi-in-various-servers/200565/2 "2010-12-15T23:36:36Z")

</div>

Hi,

On 15/12/2010 22:00, Antonio wrote:

> I have a question about fastcgi. If I use 5 web server with fastcgi, with a  
> script that works with session variables, if  
> it balances the request to another different server. How to access the session  
> variables? As will be stored in another  
> /tmp/SESSION\_XXX (other machine).

You have either to store your sessions on a common shared  
backend (moderns web scripting languages allows storing  
sessions in memcached or database, but you can also use NFS  
for instance, ..), or just reduce the odd to loose the  
sessions (for instance by using the ip\_hash option for the  
upstream backend, so clients will stick to the same server  
unless nginx detects this servers isn’t available anymore).

> I can use in nginx fastcgi servers located on another machine, some  
> configuration examples?. Thanks.

Maybe there ?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

---

<div class="post-metadata">

**Author:** ![antonio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@antonio](https://www.ruby-forum.com/u/antonio)\
**Post date:** [December 17, 2010, 8:52am UTC](https://www.ruby-forum.com/t/fastcgi-in-various-servers/200565/3 "2010-12-17T08:52:25Z")

</div>

El 15/12/10 23:34, Benjamin Pineau escribi:

> sessions (for instance by using the ip\_hash option for the  
> upstream backend, so clients will stick to the same server  
> unless nginx detects this servers isn’t available anymore).
> 
> > I can use in nginx fastcgi servers located on another machine, some  
> > configuration examples?. Thanks.  
> > Maybe there ?  
> > [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpUpstreamModule)  
> > [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpFcgiModule)  
> > [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/FcgiExample)

Hi

Thanks !

Regards
