Bad Gateway with NGinx & Unicorn

I am using NGinx as proxy to load balance the traffic. Behind Nginx their are some unicorn servers. On Friday I did some changes on the server and I realized that I am always running into a Bad Gateway error. The way from Nginx to unicorn worked. But the way back not really.

I googled for it and I found out that the problem is the buffer size on NGinx. After setting the buffer sizes up like this here, it worked fine for me.

proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

You have to add this to your default.conf file in “/etc/nginx/conf”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s