Capistrano::nginx
Nginx support for Capistrano 3.x
Installation
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
Usage
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, :allTasks
This gem provides the following Capistrano tasks:
-
nginx:setupcreates/etc/nginx/sites-available/APPLICATION.confand links it to/etc/nginx/sites-enabled/APPLICATION.conf -
nginx:stopinvokesservice nginx stopon server -
nginx:startinvokesservice nginx starton server -
nginx:restartinvokesservice nginx restarton server -
nginx:reloadinvokesservice nginx reloadon server -
nginx:force-reloadinvokesservice nginx force-reloadon server -
nginx:enable_sitecreates symlink in sites-enabled directory -
nginx:disable_siteremoves symlink from sites-enabled directory
Contributing
- 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