ror3生产环境部署

sh-4.1$ ./sbin/nginx -v
nginx version: nginx/0.7.67
查看nginx版本

使用strings /usr/local/nginx/sbin/nginx | grep configure
查看安装的nginx的原有安装的配置

reference:
http://www.5013.org/?p=34

ssh公钥
mkdir -p /home/mlzboy/opt/src && cd /home/mlzboy/opt/src

安装 Phusion Passenger

用 gem 安装 passenger,将会安装到 /home/jerry/.rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15,

$  gem install -V passenger   

安装 nginx 服务器

下载最新 stable 版 nginx

$  mkdir -p /home/jerry/opt/src && cd /home/jerry/opt/src
$  wget http://nginx.org/download/nginx-0.7.67.tar.gz
$  tar xvf nginx-0.7.67.tar.gz

安装编译相关类库

$  sudo apt-get install libpcre3-dev  

  sudo apt-get install libcurl4-openssl-dev
Nginx with Passenger support was successfully installed.
The Nginx configuration file (/usr/local/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Passenger
to function correctly.
This installer has already modified the configuration file for you! The
following configuration snippet was inserted:
  http {
      ...
      passenger_root /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1;
      passenger_ruby /home/mlzboy/.rvm/wrappers/ruby-1.9.2-p0/ruby;
      ...
  }
After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.
Press ENTER to continue.
This installer has already modified the configuration file for you! The
following configuration snippet was inserted:
  http {
      ...
      passenger_root /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1;
      passenger_ruby /home/mlzboy/.rvm/wrappers/ruby-1.9.2-p0/ruby;
      ...
  }
After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Ruby on Rails application in /somewhere. Add a server block
to your Nginx configuration file, set its root to /somewhere/public, and set
'passenger_enabled on', like this:
   server {
      listen 80;
      server_name www.yourhost.com;
      root /somewhere/public;   # <--- be sure to point to 'public'!
      passenger_enabled on;
   }
And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:
  /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1/doc/Users guide Nginx.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
passanger相关部署好文
sudo service apache2 stop
sudo ./sbin/nginx -s reload 重载配置

  1. Open a terminal, and type:
    gem install passenger
  2. Type:
    passenger-install-apache2-module

    Or, if you want to install the Nginx version instead:

    passenger-install-nginx-module

    And follow the instructions.

    Or, for the standalone version, type:

    cd /path/to/your/webapp
    passenger start

If you encounter any problems, please read the Users guide (Apache)/Users guide (Nginx)/Users guide (Standalone) for troubleshooting tips and/or try the tarball below.

Native Ubuntu Linux package

John Leach from Brightbox has kindly provided Ubuntu packages for Phusion Passenger. The package is available from the Brightbox repository which you can find at http://apt.brightbox.net.

Add the following line to the Third Party Software Sources:

deb http://apt.brightbox.net hardy main

(The simplest way to do that is to create a file in /etc/apt/sources.list.d/ containing the deb instruction, and then run 'apt-get update').

Once you've done this then you can install Phusion Passenger by running:

apt-get install libapache2-mod-passenger

or, for the Nginx version:

apt-get install nginx-brightbox

Please also visit the package's wiki page for more documentation about this package.

Download source code
To install Passenger from source code, extract the source tarball:
tar xzvf passenger-X.X.X.tar.gz

Then run the included installer:

./passenger-X.X.X/bin/passenger-install-apache2-module

or, for the Nginx version:

./passenger-X.X.X/bin/passenger-install-nginx-module
Older versions
Older versions of Passenger can be obtained from the RubyForge project page.
Ruby Enterprise Edition
You can transparently reduce memory usage of your Rails applications by about 33%, by using Ruby Enterprise Edition.

Learn more

===============

sudo apt-get intall curl git-core

  • sudo apt-get install curl bison build-essential git-core   
  • sudo apt-get install zlib1g-dev libssl-dev libreadline5-dev libxml2-dev   


  • 以下内容经测试可用
  • 通过 RVM 安装 Rails 3

    2010年8月10日发表   2010年8月11日更新

    Rails 3 RC 版半个月前就已经发布,而正式版据说会在未来几周内面世。相对于 2.3 版,Rails 3 差不多在各个方面都作出了改进。如果你准备开发新项目,现在应该是时候体验 Rails 3 的新功能了。本文将带领你在 Ubuntu 上安装 Rails 3 开发环境,你会发现,这个过程和安装 Rails 2.3 并不相同。

    Rails 和 Ruby 的发展在过去的几年内一直没有取得同步,尽管 Ruby 1.9 版已经出现相当长时间了,可是直到今天,Rails 网站上仍然推荐大家使用 1.8.7 版的 Ruby。原因是 Rails 2 基于 Ruby 1.8 开发,而 Ruby 在升级到 1.9 版时引入了许多不兼容性,这也是为什么 Ubuntu 的官方源中会同时包含两个不同版本的 Ruby。

    Rails 3 的出现改变了这个局面,最新版的 Rails 一律采用最新版的 Ruby 进行开发,这似乎也标志着 Rails 和 Ruby 已经进入相对平稳的发展阶段。(如果说 Rails 在国内没有发展成为主流技术是因为功能变化太快,那么 Rails 3 的发布说不定会带来新的转机。希望如此。)

    由于 Ruby 1.8 和 1.9 并不兼容,尽管在 Ubuntu 上这两个版本都可以通过软件包管理器安装,但是我们无法同时使用基于 Ruby 1.8 的 Rails 2 和基于 Ruby 1.9 的 Rails 3(事实上,Rails 3 可以支持 Ruby 1.8.7,但为了跟上发展步伐,还是建议使用 1.9 版的 Ruby)。如果我们还有许多采用 Rails 2 编写的旧项目需要维护的话,问题将会变得非常复杂。

    要解决这个问题,我们需要借助于一个聪明的 Shell 脚本程序——RVM(Ruby Version Manager),利用它,我们可以在自己的机器上同时安装多个版本的 Ruby,之后只需要一条命令即可随意切换。

    安装 RVM

    当前 RVM 还在进行密集型开发,其作者 Wayne Seguin 建议从 GitHub 上获取最新版代码来安装,作为 Shell 高手,他还为我们准备好了一段脚本,只要执行下面这行命令,工作将自动完成:

    $ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

    你会注意到,在输出信息中有一段警告,要求我们修改 .bashrc 文件。请用任意文本编辑器打开 ~/.bashrc 文件,找到包含有如下文字的一行:

    [ -z "$PS1" ] && return

    删除这行文字(必须删除,注释无效),并改为:

    if [[ -n "$PS1" ]]; then

    然后在文件的结尾添加下面的两行:

    fi
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

    之所以要修改 .bashrc 文件,是因为 RVM 将作为 Shell 函数使用,我们需要在初始化 Shell 时(如打开终端窗口或执行某个命令)加载 RVM。你可以打开一个新的终端窗口,输入下面的命令来判断 RVM 是否安装成功:

    $ type rvm | head -n1

    如果返回 “rvm is a function”,则说明一切正常。

  • 原文地址:https://www.cnblogs.com/lexus/p/1901192.html