ruby-on-rails – Rails – 在使用Capistrano部署后需要重新启动Nginx?

我正在使用Capistrano部署我的Rails应用程序.每当我部署,更改不会反映在浏览器,我仍然需要重新启动nginx来更新网站(运行sudo /etc/init.d/nginx重新启动).我不太确定为什么重新启动应用程序后不应该更新? (使用touch /app/tmp/restart.txt)

这是我的deploy.rb

require "rvm/capistrano"
set :rvm_ruby_string,'ruby-1.9.3-p194@app_name'
set :rvm_type,:user

require "bundler/capistrano"

set :application,"app_name"
set :user,"me"

set :deploy_to,"/home/#{user}/#{application}"
set :deploy_via,:copy

set :use_sudo,false

set :scm,:git
set :repository,"~/Sites/#{application}/.git"
set :branch,"master"

role :web,'1.2.3.4'
role :app,'1.2.3.4'
role :db,'1.2.3.4',:primary => true
role :db,'1.2.3.4'

namespace :deploy do
 task :start do ; end
 task :stop do ; end
 task :restart,:roles => :app,:except => { :no_release => true } do
   run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
 end
end

最佳答案
我意识到部署设置匹配
http://coding.smashingmagazine.com/2011/06/28/setup-a-ubuntu-vps-for-hosting-ruby-on-rails-applications-2/

当我遵循本教程(大约一年前),我安装了较新版本的nginx和乘客.从我记得,我认为这些较新的版本促使我在运行任何类型的init.d命令时使用nginx作为服务. (Ubuntu 10.04)

无论如何,我会切换代码

run "#{try_sudo} touch #{File.join(current_path,'restart.txt')}"

run "#{sudo} service nginx #{command}"

看看是否有效.

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。