Skip to content

Instantly share code, notes, and snippets.

@sheharyarn
Created June 27, 2015 20:53
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheharyarn/2edbd7ecb4ea3b70d334 to your computer and use it in GitHub Desktop.
Save sheharyarn/2edbd7ecb4ea3b70d334 to your computer and use it in GitHub Desktop.
Nginx Tasks for Capistrano 3
# Add this file to "rails_app/lib/capistrano/tasks/nginx.rake"
# This will create these tasks:
# - cap stage nginx:start
# - cap stage nginx:stop
# - cap stage nginx:restart
# - cap stage nginx:reload
# Because of "sudo", you'll have to put nginx commands in your visudo file
# See this: https://gist.github.com/sheharyarn/f3d98e8cc859f092532b
namespace :nginx do
%w(start stop restart reload).each do |command|
desc "#{command.capitalize} Nginx"
task command do
on roles(:app) do
execute :sudo, "service nginx #{command}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment