doc: kill Dir.chdir example
[unicorn.git] / FAQ
blob75f373b1a36aff7403386dd6609ce64b32c5054d
1 = Frequently Asked Questions about Unicorn
3 ===  I've installed Rack 1.1.x, why can't Unicorn load Rails?
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.x.
10 === Why are my redirects going to "http" URLs when my site uses https?
12 If your site is entirely behind https, then Rack applications that use
13 "rack.url_scheme" can set the following in the Unicorn config file:
15   HttpRequest::DEFAULTS["rack.url_scheme"] = "https"
17 For frameworks that do not use "rack.url_scheme", you can also
18 try setting one or both of the following:
20   HttpRequest::DEFAULTS["HTTPS"] = "on"
21   HttpRequest::DEFAULTS["HTTP_X_FORWARDED_PROTO"] = "https"
23 Otherwise, you can configure your proxy (nginx) to send the
24 "X-Forwarded-Proto: https" header only for parts of the site that use
25 https.  For nginx, you can do it with the following line in appropriate
26 "location" blocks of your nginx config file:
28   proxy_set_header X-Forwarded-Proto https;
30 === Why are log messages from Unicorn are unformatted when using Rails?
32 Current versions of Rails unfortunately overrides the default Logger
33 formatter.
35 You can undo this behavior with the default logger in your Unicorn
36 config file:
38   Configurator::DEFAULTS[:logger].formatter = Logger::Formatter.new
40 Of course you can specify an entirely different logger as well
41 with the "logger" directive described by Unicorn::Configurator.
43 === Why am I getting "connection refused"/502 errors under high load?
45 Short answer: your application cannot keep up.
47 You can increase the size of the :backlog parameter if your kernel
48 supports a larger listen() queue, but keep in mind having a large listen
49 queue makes failover to a different machine more difficult.
51 See the TUNING and Unicorn::Configurator documents for more information
52 on :backlog-related topics.