I have a server set on a VPS serving up a production Rails app via Nginx + Unicorn. Presently this works fine with the following conf files:
However the added subdomain of staging.appname.tld
ends up yielding the following error in /var/log/nginx/error.log
:
2012/08/20 16:57:39 [error] 24673#0: *174 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: staging.appname.com, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.appname_staging.sock:/", host: "staging.appname.com"
2012/08/20 16:58:17 [error] 24673#0: *178 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: staging.appname.com, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.appname_staging.sock:/", host: "staging.appname.com"
2012/08/20 16:59:29 [error] 24673#0: *182 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: staging.appname.com, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.appname_staging.sock:/", host: "staging.appname.com"
The configurations proffering this error are:
Additionally, the socks do exist! If we look in /tmp/ we see: unicorn.appname.sock
and unicorn.appname_staging.sock
And here is the nginx -V
output.
It would seem as though something is off in the config, however I'm just not seeing it. Could someone please advise as to where this error is coming from and how to properly set up subdomains such as a staging environment in this context?
Best Answer
I don't see anything that's wrong in your config, although some minor stuff to improve but nothing that should break it. Could you please activate debug logging and post the log here.
And please have a look at the following revised configuration (with activated debug logging).