Skip to content

Instantly share code, notes, and snippets.

@tomkersten
Created September 27, 2011 03:01
Show Gist options
  • Save tomkersten/1244207 to your computer and use it in GitHub Desktop.
Save tomkersten/1244207 to your computer and use it in GitHub Desktop.
Why isn't this working?
# After shutting down the app servers, the clients (open browsers) get a dump
# of all messages which have been held back...and this is dumped out to the nginx log
2011/09/26 22:55:57 [error] 5042#0: *1 connect() failed (111: Connection refused) while
connecting to upstream, client: 204.51.3.162, server: somedomain.com, request:
"GET /stream/0D9A1580 HTTP/1.1", upstream: "http://127.0.0.1:5000/stream/0D9A1580",
host: "somedomain.com", referrer: "http://somedomain.com/tags/0D9A1580/"
$ nginx -v
nginx: nginx version: nginx/1.1.4
$ bundle exec thin -v
thin 1.2.11 codename Bat-Shit Crazy
##### nginx config
upstream thin {
keepalive 1;
server 127.0.0.1:5000;
server 127.0.0.1:5001;
server 127.0.0.1:5002;
}
server {
server_name somedomain;
root /opt/somedomain/website/public;
access_log /var/log/nginx/somedomain-access.log;
error_log /var/log/nginx/somedomain-error.log;
rewrite_log on;
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
location / {
try_files $uri $uri/ @appservers;
}
location @appservers {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://thin;
}
location ~ ^/(images|javascripts|stylesheets|system)/ {
expires max;
}
#error_page 500 502 503 504 /500.html;
}
@tomkersten
Copy link
Author

Updated nginx config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment