0.04
No commit activity in last 3 years
No release in over 3 years
Simple nginx management for Capistrano 3.x
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

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, :all

Tasks

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 invokes service nginx stop on server
  • nginx:start invokes service nginx start on server
  • nginx:restart invokes service nginx restart on server
  • nginx:reload invokes service nginx reload on server
  • nginx:force-reload invokes service nginx force-reload on server
  • nginx:enable_site creates symlink in sites-enabled directory
  • nginx:disable_site removes symlink from sites-enabled directory

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request