RailsProductionServer @ Nginx + Postgresql + Ubuntu remote deployment configuration using git

Source: Internet
Author: User
Tags using git
It seems that Heroku access in China is slow and unstable, so you have to build a production server on your own. Our goal is to be similar to Heroku, which can be directly deployed and run from the development environment. Although it seems that there are many documents, there are still many problems. ------------------------------------------------------ Warning: If the directory permission configuration is incorrect, rails always reports 404 RVM installation.

It seems that Heroku access in China is slow and unstable, so you have to build a production server on your own. Our goal is to be similar to Heroku, which can be directly deployed and run from the development environment. Although it seems that there are many documents, there are still many problems.

------------------------------------------------------

Warning it seems that if the directory permission configuration is incorrect, rails will always report 404

Install RVM
  1. # I am a global rvm installed on the root server. Please modify the corresponding settings if you use an account-based rvm.
  2. Curl-L get. rvm. io | bash-s stable 
  3. # Add user to rvm group
  4. Vi/etc/group
  5. Source/etc/profile. d/rvm. sh
 
  1. # If the task is successful, the rvm is a function.
 
  1. Type rvm | head n1
Install ruby
  1. Apt-get install build-essential bison openssl curl git-core zlib1g zlib1g-dev libssl-dev
  2. Rvm install 1.9.2
  3. Rvm use 1.9.2 -- default
Install passenger
  1. Rvm 1.9.2 -- passenger
  2. Gem install passenger
  3. Rvmsudo passenger-install-nginx-module
You will be prompted to download and install nginx. you can install nginx according to the configuration, and you will need to do two things later. 1. Get the nginx STARTUP script.
  1. Git clone git: // github.com/jnstq/rails-nginx-passenger-Ubuntu.git
  2. Sudo mv rails-nginx-passenger-ubuntu/nginx/etc/init. d/nginx
  3. Sudo chown root: root/etc/init. d/nginx
2. Modify nginx Configuration
  1. Server {
  2. Listen 80; # the server will be running on this port
  3. Server_name www.yourhost.com;
  4. Root/home/deployer/your_rails_project/public ;#<---Be sure to point to 'public '!
  5. Passenger_enabled on;
  6. }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.