Nginx support for Capistrano 3.x
Add this line to your application's Gemfile:
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-nginx', '~> 1.0.0'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-nginx
Require in Capfile
:
require 'capistrano/nginx'
Launch new tasks:
$ cap production nginx:setup
$ cap production nginx:reload
If you want to customize the nginx configuration, you can use the Rails generator to create a local copy of the config template:
$ rails generate capistrano:nginx:config
And then edit config/deploy/nginx_conf.erb
as you like.
Configurable options, shown here with defaults:
set :nginx_path, '/etc/nginx' # directory containing sites-available and sites-enabled
set :nginx_template, 'config/deploy/nginx_conf.erb' # configuration template
set :nginx_server_name, 'example.com' # optional, defaults to :application
set :nginx_upstream, 'example-app' # optional, defaults to :application
set :nginx_listen, 80 # optional, default is not set
set :nginx_roles, :all
This gem provides the following Capistrano tasks:
nginx:setup
creates/etc/nginx/sites-available/APPLICATION.conf
and links it to/etc/nginx/sites-enabled/APPLICATION.conf
nginx:stop
invokesservice nginx stop
on servernginx:start
invokesservice nginx start
on servernginx:restart
invokesservice nginx restart
on servernginx:reload
invokesservice nginx reload
on servernginx:force-reload
invokesservice nginx force-reload
on servernginx:enable_site
creates symlink in sites-enabled directorynginx:disable_site
removes symlink from sites-enabled directory
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request