# Upstream with fastcgi\_pass

**URL:** <https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028>\
**Category:** NGINX\
**Created:** [November 22, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028 "2007-11-22T22:36:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rapsey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Rapsey](https://www.ruby-forum.com/u/Rapsey)\
**Post date:** [November 22, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028/1 "2007-11-22T22:36:22Z")

</div>

I have 5 instances of a FCGI application. My config is like this:

upstream servercom {  
server 127.0.0.1:44440;  
server 127.0.0.1:44441;  
server 127.0.0.1:44442;  
server 127.0.0.1:44443;  
server 127.0.0.1:44444;  
}

location ~ .app$ {  
fastcgi\_pass servercom;  
fastcgi\_index stream.app;  
fastcgi\_param SCRIPT\_FILENAME  
/var/www/htdocs$fastcgi\_script\_name;  
include /etc/nginx/fastcgi.conf;  
}

The FCGI application uses X-Accel-Redirect to return a .flv video. The  
problem is that it only works for 1 file. After that, nginx always  
throws 404.

If I don’t use upstream servercom and have fastcgi\_pass like so:  
location ~ .app$ {  
fastcgi\_pass 127.0.0.1:44440;  
fastcgi\_index stream.app;  
fastcgi\_param SCRIPT\_FILENAME  
/var/www/htdocs$fastcgi\_script\_name;  
include /etc/nginx/fastcgi.conf;  
}

It will work fine and always return the file that the FCGI application  
sent by X-Accel-Redirect

---

<div class="post-metadata">

**Author:** ![Rapsey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Rapsey](https://www.ruby-forum.com/u/Rapsey)\
**Post date:** [November 23, 2007, 10:05am UTC](https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028/2 "2007-11-23T10:05:45Z")

</div>

On Thu, Nov 22, 2007 at 10:23:47PM +0100, Rapsey wrote:

> throws 404.  
> sent by X-Accel-Redirect  
> It seems that you did not configure properly FCGI on  
> 127.0.0.1:44441 - 127.0.0.1:44444

---

<div class="post-metadata">

**Author:** ![Rapsey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Rapsey](https://www.ruby-forum.com/u/Rapsey)\
**Post date:** [November 23, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028/3 "2007-11-23T16:40:05Z")

</div>

Well the thing is that requests that return HTML always succeed, only  
X-Accel-Redirect responses fail with upstream.

---

<div class="post-metadata">

**Author:** ![Rapsey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3be4f8/32.png) [@Rapsey](https://www.ruby-forum.com/u/Rapsey)\
**Post date:** [November 23, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/upstream-with-fastcgi-pass/121028/4 "2007-11-23T16:43:03Z")

</div>

Also the application always receives the request and sends it’s  
response successfully.
