UbuntuServer: Configure Ruby Enterprise Edition + Nginx + passenger + rails3 + PHP + FPM

Source: Internet
Author: User
A lot of rails materials are examples of using Apache. I prefer Nginx with higher performance, so I found some information and tried it step by step to correct some errors in the materials, formed the following formal document. Thanks to the network and the author of many documents: the actual installation and test version is UbuntuServer10.0432-bit X86,

RaiLsI prefer Nginx with higher performance, so I found some information and tried it step by step to correct some errors in the information, formed the following formal document. Thanks to the Internet and the author of many documents :)

The actual installation and test version are Ubuntu Server 10.04 32-bit X86, but theoretically, the following steps are also applicable to Ubuntu Server 9.04 and desktop. The main installation goal is to build a high-speed running environment based on rails3 of ruby Enterprise Edition, and support it on this server.PhpAnd related tools. Why should we use ruby Enterprise Edition? Well, according to official website information, ruby Enterprise Edition is more stable, and its memory performance has improved by more than 33%.
The installation steps are as follows:

1. Install ubntun

Create a non-root User

ADdUser shuqi888
Update Source

SuDo apt-get upDate
Sudo apt-get upgrade
Correct Time Zone

Sudo dpkg-reconfigure tzdata
Select Asia and then chongqing ]. Check whether the settings are correct:

Date
2. install some general packages

Passenger and many other programs are required for installation. install them in advance.

The most important thing is the gcc compiling environment.

Sudo apt-get install gcc
Sudo apt-get install build-essential
NextGit.

Sudo apt-get install git-core
First download,Extract.

Sudo apt-get install libcurl4-openssl-dev libssl-dev zlib1g-dev libreadline5-dev
Finally, the image library imagemagick

Sudo apt-get install imagemagick
Create a directory for managing downloaded files

Go to your home directory and create a temporary folder to manage the files to be downloaded in the future.

Cd/Home/shuqi888
MkdirDownload

3. Install mysql

Sudo apt-get install mysql-server mysql-client
Remember the password entered during installation.

4. Install ree

Go to the previously created download directory,

Cd/home/shuqi888/download
Log onto ree official website http://www.ruByeNterpriseEdItion.com/download.html

Find the latest version and use wget to download it to the directory:

Wget http://rubyforge.org/frs/download.php/71100/ruby-enterprise_1.8.7-2010.02_i386_Ubuntu10.04.deb
Then start Installation

Sudo dpkg-I ruby-enterprise_1.8.7-2010.02_i386_Ubuntu10.04.deb
Check whether the installation is successful:

Ruby-v
Normal output:

Ruby 1.8.7 (2010-04-19PatchLevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02
Use both

Gem list
We can see that ree has added some older versions of gem by default, such as rails (2.3.8) and passenger (2.2.14. In subsequent steps, we will update these gems.

5. install rail and update the gem that has been installed by ree by default. // This step requires a high network speed. Sometimes it will fail and be re-executed.CommandOkay.

Gem update -- system
Gem install rake
Gem install rails
Gem update

6. Install nginx and passenger

Before installing passphrase, run the gem list command to check the installed versions of passphrase. If it is not the latest version, use the gem install passenger command instead of the gem update command to update it.

Follow the instructions in the official passenger Installation Guide to start installation:

Passenger-install-nginx-moDuLe
Follow the prompts on the page to install it by default. After successful installation, check whether nginx is successfully installed:

Open the default installation directory of nginx:

Sudo nano/opt/nginx/conf/nginx. conf
Make sure that:

Http {
...
Passenger_root/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0;
Passenger_ruby/usr/local/bin/ruby;
...
}
If passenger_ruby is not a ruby interpreter pointing to ree, it will cause subsequent gem source loss issues. Be sure to make sure the ruby pointed to here is consistent with the ruby environment you are using.

If passenger is not directed to version 3.0, the following error occurs: Unable to start the Phusion Passenger watchdog.

Start nginx

Sudo/opt/nginx/sbin/nginx
Restart:

Sudo/opt/nginx/sbin/nginx-s reload
Refresh the home page to display the nginx welcome interface. If not, reboot is often required.

7. Configure nginx to start at random

Passenger installs nginx under/opt/nginx by default, which is slightly different from the path for directly installing nginx. Pay special attention to this.

Refer to Gist525330 to write a script to:/etc/init. d/nginx. The command is as follows:

Cd/home/anrenserver/download/
Git clone git: // gist.github.com/525330.git
SudoMv525330/nginx. sh/etc/init. d/nginx
Chmod+ X/etc/init. d/nginx
# Sudo cannot be used hereChownOther methods for changing Permissions
Let the startup script start at random:

Sudo/usr/sbin/update-rc.d-f nginx defaults
Sudo/etc/init. d/nginx start
If successful, you can directly use start, stop, restart, and reload to control nginx.

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.