Nginx Sock And Rails Envinroment Error

Alex Barlow alexbarlowis at me.com
Mon Feb 15 05:38:46 EST 2010


Hi

It goes

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

Strange i know!

Ill try the socket in /tmp/ see what that does.

The Nginx error logs show nothing error wise really. My Nginx config is...

user  nginx;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;
    gzip  on;

	upstream unicorn_sock {
		server unix:/root/pbr/unicorn.sock;
	}
	
    server {
        listen       80;
        server_name  localhost;
		proxy_set_header Host $host;

        location / {
			proxy_pass  http://unicorn_sock;
        }
    }
}

This is currently throwing out verbose errors, in production (must be, its using asset host and the production database)

Put the sock in /tmp, no difference

On 15 Feb 2010, at 07:30, Eric Wong wrote:

> Alex Barlow <alexbarlowis at me.com> 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