How to use Capistrano with Apache or Nginx? [closed] How to use Capistrano with Apache or Nginx? [closed] apache apache

How to use Capistrano with Apache or Nginx? [closed]


When you deploy, capistrano creates a folder in the releases folder, and then symlinks that folder to /your_app/current.

Since the part of your rails app that you expose to the public is the public folder, you need to set the root in your nginx config to:

root /path_to_your_app/current/public; 

With each deploy the contents of current will effectively be refreshed from the source, any data not committed to the source control would be lost, and this is where the shared folder comes in. The shared folder will contain things which aren't going to be in the version control, but that you don't want to lose with each deploy - application logs, uploaded images, etc.

Here's a good example of how to use the shared folder for uploads: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/

Restarting the web server can be achieved with the following task in your deploy.rb:

namespace :deploy do  task :restart do    run "touch #{current_path}/tmp/restart.txt"  endend

Phusion passenger monitors for this file, and will trigger a restart when it's created.