`
myrev
  • 浏览: 163215 次
  • 性别: Icon_minigender_1
  • 来自: 福建
社区版块
存档分类
最新评论

Nginx + Passenger -- RVM

阅读更多

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
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics