Nginx Sock And Rails Envinroment Error

Eric Wong normalperson at
Mon Feb 15 02:30:43 EST 2010

Alex Barlow <alexbarlowis at> wrote:
> Hi There,
> Im running an amazon instance with nginx proxying to a unicorn sock.
> For some reason, even though i specify the production environment,
> when being visited by nginx, the site shows errors in  development
> form.
> Interestingly, when running on a port rather than a sock, if i visit
> that port, the errors are rendered as normal with a 500 page, the same
> port, throught nginx, shows errors like you do in development.

Hi Alex,

Sorry, I'm having a little trouble following you, so you're saying:

client <- TCP -> Unicorn                         => quiet errors (good)
client <- TCP -> nginx <- TCP -> Unicorn         => verbose errors (bad)
client <- TCP -> nginx <- Unix socket-> Unicorn  => verbose errors (bad)

Are you sure you have nginx configured correctly and pointing to the
right instance of your app?  Mind sharing your nginx config file?

> The app is rails latest (not 3), i run it with unicorn_rails -E
> production -c /root/pbr/current/config/unicorn.rb -D
> and unicorn.rb looks like..
> worker_processes (20)
> preload_app(true)
> Im thinking it could be a permissions problem, the rails directory is
> in under root, nginx runs as user nginx, but i have given chown
> permission the the directory?

nginx error logs should tell you if you have permissions problems.

I usually specify domain sockets as a dot file in /tmp since I know
the directory is world read/writeable on a properly configured system
and path resolution is slightly faster :)

Eric Wong

More information about the mongrel-unicorn mailing list