No commit activity in last 3 years
No release in over 3 years
Capistrano tasks for automatic nginx configuration Work *only* with Capistrano 3+
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0

Runtime

~> 1.2
 Project Readme

Capistrano::SimpleNginx

Support for Capistrano 3.x

Installlation

Add this line to your application's Gemfile:

gem 'capistrano'
gem 'capistrano-simple-nginx', '~> 0.0.1'

And then run:

$ bundle

Or install it yourself as:

$ gem install capistrano-simple-nginx

Usage

Require in Capfile:

require 'capistrano/simple-nginx'
  • Generate file config nginx, run:
$ cap production nginx:setup
  • start|stop|restart nginx, run:
$ cap production nginx:start
$ cap production nginx:stop
$ cap production nginx:restart

You need add directory to sock file of app. Example using unicorn for app:

# in config/deploy.rb
set :nginx_upstream_file, "/tmp/unicorn.sock"

Default config

    set :nginx_listen_port, 80 #listen_port
    set :nginx_server_name, "_" #server_name
    set :nginx_upstream_name, -> { "#{fetch(:application)}" } # upstream name
    set :nginx_config_name, -> { "#{fetch(:application)}_#{fetch(:stage)}" } #file name config
    set :nginx_fail_timeout, 0
    set :nginx_access_log_file, -> { "/var/log/nginx/#{fetch(:nginx_config_name)}.access.log" } # access log file
    set :nginx_error_log_file, -> { "/var/log/nginx/#{fetch(:nginx_config_name)}.error.log" } # error log file
    set :nginx_upstream_file, -> { "/tmp/#{fetch(:application)}.sock" } # .sock file path