如何使用Capistrano的与Apache或Nginx的? [英] How to use Capistrano with Apache or Nginx?

查看:187
本文介绍了如何使用Capistrano的与Apache或Nginx的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行帽部署可以创建一些文件夹,如发布共享。什么是它们之间的关系, Apache或Nginx的的服务器的根?

When run cap deploy can create some folders such as releases or shared.What's the relation between them and Apache or Nginx's server root?

这是方法吗?(这是一个Nginx的配置)

Is this method right?(This is a Nginx config)

server {
  listen 80;
  server_name www.yourhost.com;
  root /releases/...;   # Which path to be here???
  passenger_enabled on;
}

和也,运行后帽部署,可以通过Web服务器自动重启?

And also,after running cap deploy,can web server automatic restart?

推荐答案

在部署Capistrano的会在发行文件夹中的文件夹,然后将该文件夹符号链接 / your_app /电流

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

既然你暴露给公众的Rails应用程序的部分是公共文件夹,您需要在nginx的配置设置根:

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.

下面是如何使用的上传共享文件夹的一个很好的例子:<一href=\"http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/\">http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/

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

重新启动web服务器可以与你的deploy.rb以下任务来实现:

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"
  end
end

此文件的Phusion乘客显示器,它的创建时将触发重新启动。

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

这篇关于如何使用Capistrano的与Apache或Nginx的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆