Install and configure the ror environment on linux

Source: Internet
Author: User
Install and configure the ror environment on linux-Linux Enterprise Application-Linux server application information. For more information, see. First download ruby
Cd/home/local
Wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz

Download the source code package to the local Linux host, decompress it, enter the directory, configure, compile, and install it:
Tar xzvf ruby-1.8.6-p111.tar.gz
Cd ruby-1.8.6-p111
./Configure? Prefix =/home/servers/ruby
Make & make install
To view all the configure parameters, you can:
./Configure? Help | more
If you do not customize the installation directory, it will be installed under the/usr/local directory by default. However, we recommend that you customize a ruby installation directory, such as/home/servers/ruby, to facilitate future upgrades without mixing with other software in the operating system.
After installation, modify the PATH of the operating system and add/home/servers/ruby/bin:
Export PATH =/home/servers/ruby/bin: $ PATH
Place our self-installed ruby in front of the system PATH to avoid interference caused by the built-in ruby in the operating system. In Linux, the settings are generally placed in/etc/profile for global effect.
After the server is restarted --->
Enter ruby-v to check whether the version is available.

Before installing rails, install rubygems first. Rubygems is ruby's online package management tool, which can be downloaded from rubyforge.
Download, decompress, and install the source code package:
Cd/home/servers/
Wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz

Tar xzvf rubygems-1.0.1.tgz
Cd rubygems-1.0.1.tgz
Ruby setup. rb
After installation is complete, only enter
Gem-v
Check if the version is 1.0.1.
Then you can install rails and run the following command to confirm that the server is connected to the Internet:
Gem install rails? Y
Download all the rails dependency packages from the rubyforge website through gem.
After installing rails, run the following command:
Rails? V
Check the rails version.
Because the fcgi support library of ruby needs to be connected to the FCGI system library during compilation, we need to first install the FCGI library and download the FCGI source code release package:
Cd/home/local/
Wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz

Tar xzvf fcgi-2.4.0.tar.gz
Cd fcgi-2.4.0
./Configure -- prefix =/home/servers/fcgi
Make & make install
Similarly, install fcgi in the specified directory instead of the default/usr/local directory to avoid mixing multiple software.
Then you can install the fcgi database of rubyto download ruby-fcgi-0.8.7.tar.gz:
Cd/home/servers/

Wget http://rubyforge.org/frs/downloa... y-fcgi-0.8.7.tar.gz

Tar xzvf ruby-fcgi-0.8.7.tar.gz
Cd ruby-fcgi-0.8.7
Ruby install. rb config -- with-fcgi-include =/home/servers/fcgi/include -- with-fcgi-lib =/home/servers/fcgi/lib
Ruby install. rb setup
Ruby install. rb install
Before installing lighttpd, check that pcre is installed in the operating system, that is, the Perl-Compatible Rule expression library, and view the version of your machine:
Rpm? Q pcre
The pcre on my machine is in version 4.5.3, so I want to download pcre-devel 4.5.3 to correspond to my pcre, otherwise devel cannot be installed.
Download various versions
Http://fr.rpmfind.net/linux/rpm2html/search.php? Query = pcre-devel &
Download devel 4.5.3
Cd/home/servers
Wget ftp://fr.rpmfind.net/linux/fedor... evel-4.5-3.i386.rpm
Rpm-ivh pcre-devel-4.5-3.i386.rpm
Then download lighttpd:
Cd/home/local
Wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.gz

Tar xzvf lighttpd-1.4.18.tar.gz
Cd lighttpd-1.4.18
./Configure -- prefix =/home/servers/lighttpd
After configure is complete, an activated module and a list of unactivated modules are provided. You can check whether all required modules have been activated, "mod_rewrite" must be included in the enable module; otherwise, re-check whether the pcre is installed. Then compile and install:
Make & make install
Configuration after compilation:
Cp doc/sysconfig. lighttpd/etc/sysconfig/lighttpd
Mkdir/etc/lighttpd
Cp doc/lighttpd. conf/etc/lighttpd. conf
If your Linux is RedHat/CentOS, then:
Cp doc/rc. lighttpd. redhat/etc/init. d/lighttpd
If your Linux is SuSE, then:
Cp doc/rc. lighttpd/etc/init. d/lighttpd
For other Linux versions, you can modify them by referring to the file content. Modify/etc/init. d/lighttpd and
LIGHTTPD_BIN =/usr/sbin/lighttpd
Change
LIGHTTPD_BIN =/usr/local/lighttpd/sbin/lighttpd
This script is used to control the startup, shutdown, and restart of lighttpd:
/Etc/init. d/lighttpd start
/Etc/init. d/lighttpd stop
/Etc/init. d/lighttpd restart
If you want to start lighttpd when the server is started:
Chkconfig lighttpd on
In this way, the lighttpd is installed, and you need to configure lighttpd.
Configure Lighttpd
Modify/etc/lighttpd. conf
Vi/etc/lighttpd. conf
1) server. modules
Uncomment the module that needs to be used. mod_rewrite, mod_access, mod_fastcgi, mod_simple_vhost, mod_cgi, mod_compress, and mod_accesslog are generally used.
22.16server.doc ument-root, server. error-log, accesslog. filename need to specify the corresponding directory
3) What permissions are used to run lighttpd?
Server. username = "nobody"
Server. groupname = "nobody"
From the security perspective, it is not recommended to run the web server with the root permission. You can specify the common user permissions on your own.
4) Static File compression
Compress. cache-dir = "/tmp/lighttpd/cache/compress"
Compress. filetype = ("text/plain", "text/html", "text/javascript", "text/css ")
Some static resource types can be specified to be transmitted in compression mode to save bandwidth. for a large number of AJAX applications, the page loading speed can be greatly improved.
5) Configure ruby on rails
The simplest configuration is as follows:
$ HTTP ["host"] = "www.xxx.com "{
Server.doc ument-root = "/yourrails/public"
Server. error-handler-404 = "/dispatch. fcgi"
Fastcgi. server = (". fcgi" =>
("Localhost" =>
("Min-procs" => 10,
"Max-procs" => 10,
"Socket" => "/tmp/lighttpd/socket/rails. socket ",
"Bin-path" => "/yourrails/public/dispatch. fcgi ",
"Bin-environment" => ("RAILS_ENV" => "production ")
)
)
)
}
That is, the lighttpd starts 10 FCGI processes, and the lighttpd and FCGI communicate with each other using the local Unix Socket.
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.