ITeye博客

Nginx + Passenger -- RVM

myrev · 2010-10-25 09:16 · Rails · 编程语言 · Markdown

Nginx + Passenger -- RVM

 

 

You should install RVM.

 

1. > gem install passenger

 

2. > rvm wrapper 1.9.2 passenger

#1.9.2 is the ruby version in RVM, you can use ree or other..

 

If you use passenger 2.X

 

> rvm 1.9.2 --passenger

Run RVM using your desired Ruby interpreter, and pass the '--passenger' option. This will generate wrapper scripts in RVM's bin directory (see Notes below). These wrapper scripts ensure environment variables such as GEM_HOME and GEM_PATH are set correctly for applications run by passenger.

 

3. > rvmsudo install-passenger-nginx-module

# You should install some dependent lib..

# Passenger will help you install nginx, the folder is in /opt/nginx

 

If you can't install passenger, you need some lib.

http://rvm.beginrescueend.com/packages/

 

 

 

4. > sudo vi /opt/nginx/conf/nginx.conf

 

 

 

http {

    passenger_root /home/programmer/.rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15;

    passenger_ruby /home/programmer/.rvm/bin/passenger_ruby;

    ....

 

 

     server {

       listen 80;

       server_name ac;

       root /home/programmer/workspace/AC_rails3/public;

       passenger_enabled on;

       rails_env development;

    }

    ..

}

 

5. > sudo vi ~/.bashrc

#add

alias nst='ps aux | grep nginx'

alias sn='echo start nginx; sudo /opt/nginx/sbin/nginx ; nst'

alias kn='echo stop nginx; sudo kill `cat /opt/nginx/logs/nginx.pid` ; nst '

alias rn='kn ; sn'

#sn = start nginx

#kn = kill nginx

#rn = restart nginx

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。