sudo apt-get update
sudo apt-get install git curl
curl -sSL https://get.rvm.io | bash -s stable
他会提醒执行一条source 命令,执行,
rvm requirements
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
rvm install 2.0.0
rvm use 2.0.0 --default
gem install rails --version 4.0.0 --no-ri --no-rdoc
gem install passenger
rvmsudo passenger-install-nginx-module
在安装的时候,他们会自动检测需要什么,会给出提示。另外一点,就是虚拟内存的问题,我的云只有409MB虚拟内存,不符合passenger+nginx的最低要求,但这个时候系统也会给出提示,按照提示操作即可。
当让我们选择安装方式的时候,我们选1
安装完成之后, 在/opt下应该存在这样一个路径,/nginx/conf
git clone [email protected]:aiyuelian/railsStartShell.git
没有git的话,可以使用wget,另外这个启动脚本有问题,就是pid那个文件的目录不对,自己可能需要改.
sudo cp /path/to/nginx /etc/init.d/
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults
配置nginx.conf
nginx.conf在路径/opt/nginx/conf/
server {
listen 你的端口号;
server_name www.yourhost.com;
root /home/railsu/project/public; # <--- 这里是你项目的public目录
passenger_enabled on;
rails_env production;
}
bundle install
rake db:migrate RAILS_ENV="production"
sudo /etc/init.d/nginx start