Nginx Conf and Rails Deploy

worker_processes  1;

events {
    worker_connections  1024;
}

http {
		passenger_root /home/weizhao/.rvm/gems/ruby-1.8.7-p358/gems/passenger-3.0.11;
		passenger_ruby /home/weizhao/.rvm/wrappers/ruby-1.8.7-p358/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;
		server {
		  listen 80;
		  server_name localhost;
		  root /home/weizhao/www;
		  passenger_enabled on;
			rails_env development;

			passenger_base_uri /huafei;
		}
}

export RAILS_ENV=production 

rake db:migrate

rake assets:precompile

 

Passenger/Nginx/Ubuntu rails3.1.3

1. sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev zlib1g-dev libssl-dev build-essential curl git-core libc6-dev g++ gcc
2. sudo adduser rails
sudo usermod -G www-data,sudo rails
su - rails
3. bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
4. source .bashrc
5. rvm install 1.9.36. gem sources list
gem sources -r http://rubygems.org/
gem sources -a http://ruby.taobao.org/
7. gem install rails -v=3.1.3
rvm gemset create 1.9.3@rails312
gem install rails -v=3.1.2
rvm use 1.9.3@rais312 --default
8. gem install passenger
/lib/phusion_passenger.rb:31 PREFERRED_PCRE_VERSION = '8.12'
/lib/phusion_passenger.rb:31 PREFERRED_PCRE_VERSION = '8.21'
rvmsudo passenger-install-nginx-module
9. wget https://raw.github.com/gist/1548664/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginx

sudo cp nginx /etc/init.d/
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults   

 

 

 

 

 

 

你可能感兴趣的:(Nginx Conf and Rails Deploy)