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
- # I am a global rvm installed on the root server. Please modify the corresponding settings if you use an account-based rvm.
- Curl-L get. rvm. io | bash-s stable
- # Add user to rvm group
- Vi/etc/group
- Source/etc/profile. d/rvm. sh
- # If the task is successful, the rvm is a function.
- Type rvm | head n1
Install ruby
- Apt-get install build-essential bison openssl curl git-core zlib1g zlib1g-dev libssl-dev
- Rvm install 1.9.2
- Rvm use 1.9.2 -- default
Install passenger
- Rvm 1.9.2 -- passenger
- Gem install passenger
- 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.
- Git clone git: // github.com/jnstq/rails-nginx-passenger-Ubuntu.git
- Sudo mv rails-nginx-passenger-ubuntu/nginx/etc/init. d/nginx
- Sudo chown root: root/etc/init. d/nginx
2. Modify nginx Configuration
- Server {
- Listen 80; # the server will be running on this port
- Server_name www.yourhost.com;
- Root/home/deployer/your_rails_project/public ;#<---Be sure to point to 'public '!
- Passenger_enabled on;
- }