t/lib.perl: fix Perl integration tests w/o installation
[unicorn.git] / FAQ
blob018ca92689dd0e261fd909571fc32dcfd37b0bf8
1 = Frequently Asked Questions about Unicorn
3 === Why is nginx getting ECONNRESET as a reverse proxy?
5 Request body data (commonly from POST and PUT requests) may not be
6 drained entirely by the application.  This may happen when request
7 bodies are gzipped, as unicorn reads request body data lazily to avoid
8 overhead from bad requests.
10 Ref: https://yhbt.net/unicorn-public/FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com/
12 === Why aren't my Rails log files rotated when I use SIGUSR1?
14 The Rails autoflush_log option must remain disabled with multiprocess
15 servers such as unicorn.  Buffering in userspace may cause lines to be
16 partially written and lead to corruption in the presence of multiple
17 processes.  With reasonable amounts of logging, the performance impact
18 of autoflush_log should be negligible on Linux and other modern kernels.
20 === Why are my redirects going to "http" URLs when my site uses https?
22 If your site is entirely behind https, then Rack applications that use
23 "rack.url_scheme" can set the following in the Unicorn config file:
25   HttpRequest::DEFAULTS["rack.url_scheme"] = "https"
27 For frameworks that do not use "rack.url_scheme", you can also
28 try setting one or both of the following:
30   HttpRequest::DEFAULTS["HTTPS"] = "on"
31   HttpRequest::DEFAULTS["HTTP_X_FORWARDED_PROTO"] = "https"
33 Otherwise, you can configure your proxy (nginx) to send the
34 "X-Forwarded-Proto: https" header only for parts of the site that use
35 https.  For nginx, you can do it with the following line in appropriate
36 "location" blocks of your nginx config file:
38   proxy_set_header X-Forwarded-Proto https;
40 === Why are log messages from Unicorn are unformatted when using Rails?
42 Current versions of Rails unfortunately overrides the default Logger
43 formatter.
45 You can undo this behavior with the default logger in your Unicorn
46 config file:
48   Configurator::DEFAULTS[:logger].formatter = Logger::Formatter.new
50 Of course you can specify an entirely different logger as well
51 with the "logger" directive described by Unicorn::Configurator.
53 === Why am I getting "connection refused"/502 errors under high load?
55 Short answer: your application cannot keep up.
57 You can increase the size of the :backlog parameter if your kernel
58 supports a larger listen() queue, but keep in mind having a large listen
59 queue makes failover to a different machine more difficult.
61 See the TUNING and Unicorn::Configurator documents for more information
62 on :backlog-related topics.
64 === I've installed Rack 1.1.x, why can't Unicorn load Rails (2.3.5)?
66 Rails 2.3.5 is not compatible with Rack 1.1.x.  Unicorn is compatible
67 with both Rack 1.1.x and Rack 1.0.x, and RubyGems will load the latest
68 version of Rack installed on the system.  Uninstalling the Rack 1.1.x
69 gem should solve gem loading issues with Rails 2.3.5.  Rails 2.3.6
70 and later correctly support Rack 1.1.x.