-
Notifications
You must be signed in to change notification settings - Fork 81
Configuration
This wiki page contains the list of all the available plugin options. Unless you're looking to override something specific, you probably do not have to read this page - setup and usage section should get you covered.
In order to override the default, put the option in the stage file, example:
# in config/deploy/production.rb
set :unicorn_workers, 4
Defaults are listed near option name in the first line.
-
set :nginx_server_name
# defaults to<server_IP>
Your application's domain. The default is your server's IP address. -
set :nginx_pid, "/run/nginx.pid"
Path for nginx process pid file. -
set :nginx_location, "/etc/nginx"
Nginx installation directory. -
set :nginx_use_spdy, false
If set totrue
, nginx will be configured to enable the SPDY protocol. This only works in conjunction with SSL, songinx_use_ssl
needs to be set to true as well. You need to have nginx version 1.5.10 or higher installed to use SPDY version >= 3.1. In addition, SPDY on nginx requires OpenSSL version 1.0.0d or newer. See http://en.wikipedia.org/wiki/SPDY for general information about the SPDY protocol. -
set :fail_timeout, 0
Sets the time during which the specified number of unsuccessful attempts to communicate with the unicorn servers should happen to consider the server unavailable; and the period of time the server will be considered unavailable. See http://nginx.org/en/docs/http/ngx_http_upstream_module.html#fail_timeout for more details.
SSL related options:
-
set :nginx_use_ssl, false
If set totrue
, nginx will be configured to 443 port and port 80 will be auto routed to 443. Also, onnginx:setup
, paths to ssl certificate and key will be configured. By default the certificate file and key will be uploaded to the/etc/ssl/certs/
and/etc/ssl/private/
directories on the server.
The following options will only take effect, if :nginx_use_ssl
is set to true
:
-
set :nginx_upload_local_cert, true
Iftrue
, certificates will be uploaded from a local path. Otherwise, it is expected for the certificate and key defined in the next 2 variables to be already on the server. -
set :nginx_ssl_cert, "#{fetch(:nginx_server_name)}.crt"
Remote file name of the certificate. -
set :nginx_ssl_cert_key, "#{fetch(:nginx_server_name)}.key"
Remote file name of the certificate. -
set :nginx_ssl_cert_path, "/etc/ssl/certs/"
Remote path to the certificate. -
set :nginx_ssl_cert_key_path, "/etc/ssl/private/"
Remote path to the certificate key. -
set :nginx_ssl_cert_local_path
# no default, required ifnginx_use_ssl = true
andnginx_upload_local_cert = true
Local path to file with certificate. This file will be copied to remote server. Example value:set :nginx_ssl_cert_local_path, "/home/user/ssl/myssl.cert"
-
set :nginx_ssl_cert_key_local_path
# no default
Local path to file with certificate key. This file will be copied to remote server. Example value:set :nginx_ssl_cert_key_local_path, "/home/user/ssl/myssl.key"
-
set :nginx_pass_ssl_client_cert, false
If true, opens an additional SSL port on 444. When connecting to this port nginx request a client SSL certificate for authentication. Rails receives this certificate as request.headers['X-Client-Cert'] or request.headers['rack.session']['X-Client-Cert']. Based on custom computation, a controller can decide whether to grant access. This option is useful for e.g. a secure API endpoint. See here for more information.
Defaults are listed near option name in the first line.
-
set :unicorn_service, "unicorn_#{fetch(:application)}_#{fetch(:stage)}
Unicorn service name isunicorn_myapp_production
by default. -
set :unicorn_pid, shared_path.join("tmp/pids/unicorn.pid")
Path for unicorn process pid file. -
set :unicorn_config, shared_path.join("config/unicorn.rb")
Path for unicorn config file. -
set :unicorn_workers, 2
Number of unicorn workers. -
set :unicorn_app_env
Set to the value ofrails_env
(for compatibility with capistrano-rails gem orstage
option. -
set :unicorn_env
Environmental variables to be passed to Unicorn/Ruby. Useful for GC tweaking, etc. -
set :unicorn_use_tcp, -> { roles(:app).count > 1 }
-
true
if there are multipleapp
servers.nginx
andunicorn
communicate over tcp port. -
false
for single node configuration.nginx
andunicorn
communicate over unix socket.
-
-
set :unicorn_tcp_listen_port, 8080
Specifies tcp port whenunicorn_use_tcp
istrue
. -
set :unicorn_logrotate_enabled, false
Whentrue
, configuration files are generated for logrotate during the setup phase. Logrotate compresses and archive unicorn logs to ensure your log files don't grow too large. You need to have logrotate installed for your distribution. On Ubuntu, useapt-get install logrotate
.