1 = Frequently Asked Questions about Unicorn
3 === I've installed Rack 1.1.x, why can't Unicorn load Rails (2.3.5)?
5 Rails 2.3.5 is not compatible with Rack 1.1.x. Unicorn is compatible
6 with both Rack 1.1.x and Rack 1.0.x, and RubyGems will load the latest
7 version of Rack installed on the system. Uninstalling the Rack 1.1.x
8 gem should solve gem loading issues with Rails 2.3.5. Rails 2.3.6
9 and later correctly support Rack 1.1.x.
11 === Why are my redirects going to "http" URLs when my site uses https?
13 If your site is entirely behind https, then Rack applications that use
14 "rack.url_scheme" can set the following in the Unicorn config file:
16 HttpRequest::DEFAULTS["rack.url_scheme"] = "https"
18 For frameworks that do not use "rack.url_scheme", you can also
19 try setting one or both of the following:
21 HttpRequest::DEFAULTS["HTTPS"] = "on"
22 HttpRequest::DEFAULTS["HTTP_X_FORWARDED_PROTO"] = "https"
24 Otherwise, you can configure your proxy (nginx) to send the
25 "X-Forwarded-Proto: https" header only for parts of the site that use
26 https. For nginx, you can do it with the following line in appropriate
27 "location" blocks of your nginx config file:
29 proxy_set_header X-Forwarded-Proto https;
31 === Why are log messages from Unicorn are unformatted when using Rails?
33 Current versions of Rails unfortunately overrides the default Logger
36 You can undo this behavior with the default logger in your Unicorn
39 Configurator::DEFAULTS[:logger].formatter = Logger::Formatter.new
41 Of course you can specify an entirely different logger as well
42 with the "logger" directive described by Unicorn::Configurator.
44 === Why am I getting "connection refused"/502 errors under high load?
46 Short answer: your application cannot keep up.
48 You can increase the size of the :backlog parameter if your kernel
49 supports a larger listen() queue, but keep in mind having a large listen
50 queue makes failover to a different machine more difficult.
52 See the TUNING and Unicorn::Configurator documents for more information
53 on :backlog-related topics.