Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple nginx management with capistrano

branch: master

version bump

latest commit e7ab168b5a
Ivan Tkalin authored
Octocat-spinner-32 lib version bump
Octocat-spinner-32 test changed paths
Octocat-spinner-32 .gitignore added tests and generator;
Octocat-spinner-32 CHANGELOG.md version bump
Octocat-spinner-32 Gemfile added tests and generator;
Octocat-spinner-32 LICENSE initial
Octocat-spinner-32 README.md version bump
Octocat-spinner-32 Rakefile added tests and generator;
Octocat-spinner-32 capistrano-nginx.gemspec added readme
README.md

capistrano-nginx

This gem provides two capistrano tasks:

  • nginx:setup -- creates /etc/nginx/sites-available/YOUR_APP and links it to /etc/nginx/sites-enabled/YOUR_APP
  • nginx:reload -- invokes /etc/init.d/nginx reload on server

And nginx configuration file generator, that will create local copy of default nginx config for customization.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-nginx'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-nginx

Usage

Add this to your config/deploy.rb file:

require 'capistrano/nginx/tasks'

Make sure, following variables are defined in your config/deploy.rb:

  • application - application name
  • server_name - your application's server_name in nginx (e.g. example.com)
  • deploy_to - deployment path
  • sudo_user - user name with sudo privileges (needed to config/restart nginx)
  • app_port - application port (optional)

Launch new tasks:

$ cap nginx:setup
$ cap nginx:reload

Or you can add hook to call this tasks after deploy:setup. Add to your config/deploy.rb:

after "deploy:setup", "nginx:setup", "nginx:reload"

If you want to customize nginx configuration, just generate local nginx config before running nginx:setup:

$ rails generate capistrano:nginx:config

And then edit file config/deploy/nginx_conf.erb as you like.

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
Something went wrong with that request. Please try again.