加入收藏 | 设为首页 | 会员中心 | 我要投稿 阜阳站长网 (https://www.0558zz.com/)- 科技、建站、内容创作、云计算、网络安全!
当前位置: 首页 > 运营中心 > Nginx > 正文

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

发布时间:2020-07-22 19:00:22 所属栏目:Nginx 来源:互联网
导读:我正在使用Capistrano部署我的Rails应用程序.每当我部署,更改不会反映在浏览器,我仍然需要重新启动nginx来更新网站(运行sudo /etc/init.d/nginx重新启动).我不太确定为什么重新启动应用程序后不应该更新? (使用touch /app/tmp/restart.txt)这是我的deploy.rb

我正在使用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}"

看看是否有效.

(编辑:阜阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读