# Nginx choking on static files

**URL:** <https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271>\
**Category:** Deployment\
**Created:** [August 4, 2007, 5:55pm UTC](https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271 "2007-08-04T17:55:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwesonga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jwesonga](https://www.ruby-forum.com/u/jwesonga)\
**Post date:** [August 4, 2007, 5:55pm UTC](https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271/1 "2007-08-04T17:55:39Z")

</div>

Hi Guys,

I’m running CentOS and I’ve successfully managed to setup a mongrel  
cluster running on port 5000-5002 as well as Nginx for load balancing  
and as a reverse proxy. Everything works okay the only problem is that  
the Nginx is choking on static files like css,js and images that have  
been appended the session data example: myapp.css?786565436897 I’ve  
gone through the Nginx.conf file that Ezra at brainspl.at has posted  
and that contains a fix for the particular issue, check it out here  
[http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-caching](http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-caching)  
but the problem persists. May be there is something I’m missing in my  
Nginx.conf file, has anyone had the same problem and how did you fix  
it?

---

<div class="post-metadata">

**Author:** ![jwesonga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jwesonga](https://www.ruby-forum.com/u/jwesonga)\
**Post date:** [August 4, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271/2 "2007-08-04T19:45:46Z")

</div>

On Aug 4, 2007, at 8:54 AM, jwesonga wrote:

> [http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-](http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-)  
> caching  
> but the problem persists. May be there is something I’m missing in my  
> Nginx.conf file, has anyone had the same problem and how did you fix  
> it?  
> -~----------~----~----~----~------~----~------~–~—

Hi There-

Here is a current version of the config I use every day that works  
fine with the ?3124321 timestamps. Give this one a whirl and see if  
you hit the same problem.

[http://pastie.caboo.se/84928](http://pastie.caboo.se/84928)

Replace ‘username’ with your username.

Cheers-  
– Ezra Z.  
– Founder & Ruby Hacker  
– removed\_email\_address@domain.invalid  
– Engine Y., Serious Rails Hosting  
– (866) 518-YARD (9273)

---

<div class="post-metadata">

**Author:** ![jwesonga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jwesonga](https://www.ruby-forum.com/u/jwesonga)\
**Post date:** [August 6, 2007, 11:49am UTC](https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271/3 "2007-08-06T11:49:42Z")

</div>

Pasted the config file and changed the username but the same problem  
persists. Any idea why?

---

<div class="post-metadata">

**Author:** ![jwesonga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jwesonga](https://www.ruby-forum.com/u/jwesonga)\
**Post date:** [August 6, 2007, 2:03pm UTC](https://www.ruby-forum.com/t/nginx-choking-on-static-files/111271/4 "2007-08-06T14:03:04Z")

</div>

It seems to be working now I’m sot sure if the problem was this but I  
changed the username and group to mongrel, the same username and group  
that running the mongrel\_cluster and everything seemed to work.

I’ve been trying to setup a startup script for the nginx cluster but  
none of the commands seem to be working. I’ve already created the file  
and copied it intomy /etc/init.d folder, i’ve chmod +x the nginx file  
and when I run the sudo /sbin/chkconfig --level 345 nginx on I get an  
error?!?
