Ubuntu 7.1 server从无到有搭建jsp/php/rails全能WEB生产环境(五)
五、安装Rails环境
Rails环境使用Mongrel架设。
1、安装ruby
tar -zxvf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure –prefix=/usr/local/ruby
make
make install
将ruby加入PATH
vi /etc/profile
RUBY_HOME=/usr/local/ruby
PATH=”${RUBY_HOME}”/bin:”${JAVA_HOME}”/bin:/usr/local/mysql/bin:”${PATH}”
export PATH
退出root,重新用root登陆,验证ruby是否安装成功
ruby -v
显示版本号,说明安装成功
2、安装gem
tar -zxvf rubygems-0.9.4.tgz
cd rubygems-0.9.4
ruby setup.rb
rubygems-0.9.5好像有问题,无论gem什么包都说ssl没有安装,重新安装个rubygems-0.9.4就没问题了。
3、安装rails/mongrel/termios
apt-get install libssl-dev
gem install rake –include-dependencies
gem install rails –include-dependencies
gem install termios –include-dependencies
gem install mongrel –include-dependencies
gem install mongrel_cluster –include-dependencies
生成一个默认站点(或者将已经开发的网站上传,并配置好数据库)后,转到站点目录
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /home/dingl/rails-web/ -a 127.0.0.1
在database.yml中配置好数据库,这里是生产环境,配置production段。
如果需要使用socket方式连接mysql,增加:
socket: /tmp/mysql.sock
同时还可以指定数据传输编码:
encoding: utf8
4、启动mongrel:
mongrel_rails cluster::start
如果出现以下错误:
Cannot find gem for Rails ~>1.2.3.0:
Install the missing gem with ‘gem install -v=1.2.3 rails’
则修改config/environment.rb里rails的版本号即可
5、配置Apache与Mongrel:
修改apache的配置文件:
vi /usr/local/apache/conf/httpd.conf
在文件最后增加一个虚拟主机:
ServerName http://www.111cn.net/
RewriteEngine On
DocumentRoot /home/dingl/rails-web/
ProxyRequests Off
BalancerMember http:/

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Windows 11 introduces a wealth of new features and a comprehensively improved appearance, placing greater emphasis on unity and efficiency. So, today’s topic is how to create a Windows 11 USB installer on Mac. Performing a clean installation of Windows 11, rather than an upgrade, is the method that yields the best results when getting the operating system. Using a drive bootable in Windows 11, you can perform this task. If you have a Windows PC, making a bootable CD for Windows 11 is a very simple process. On the other hand, if you are using a Mac, the process is a little more complicated. This article will describe how to use the base

How to Use macOS Recovery to Install macOS on a New SSD On any Mac built after 2009, there is a built-in recovery system. This allows you to boot your Mac into recovery mode. In this mode, you can repair the internal disk, restore files from a Time Machine backup, get online help, or reinstall macOS. You must have an Internet connection to use these tools. You can use the macOS installation tool to install macOS on a new SSD installed in your computer. To use Internet Recovery to install macOS on an SSD: Follow the manufacturer's instructions

Install PHP on Windows using Command Prompt or PowerShell Install ChocolateyChoco Package Manager I tried the Windows default package manager Winget but could not install PHP through it. Therefore, the other best option left is to use the popular Chocolatey package manager. But unlike Winget, Choco does not exist in our Windows system by default, so we need to install it manually on our system. Go to your Windows 10 or 11 search box and type CMD, when it appears select "Run as administrator" to copy the given command

Many people may notice a phenomenon, that is, in some modern programming languages (of course, not referring to "recent" programming languages), the increment and decrement operators have been cancelled. In other words, there is no such expression as i++ or j-- in these languages, but only i+=1 or j-=1 Such an expression. This answer will explore the background and reasons for this phenomenon from the perspective of design philosophy. Strictly speaking, it may be biased to say "i++ is disappearing", because it seems that only Python, Rust and Swift among mainstream programming languages do not support the increment and decrement operators. When I first came into contact with Python, this was also

There are many ways to generate PDF in Ruby and Rails. You're probably already familiar with HTML and CSS, so we'll use PDFKit to generate PDF files from HTML in standard Rails views and style code. Introduction to PDFKit Internally, PDFKit uses wkhtmltopdf (WebKitHTML to PDF), an engine that will take HTML and CSS, render it using WebKit, and output it as a high-quality PDF. First, please install wkhtmltopdf on your computer. You can download the binaries or install from Brew on Mac or your preferred Linux repository. You also need to install pd

The main difference between Go and Ruby is that Go is a statically typed compiled language that supports lightweight parallelism and efficient memory management, and is suitable for writing high-concurrency applications; Ruby is a dynamically typed interpreted language that supports true parallelism but memory management It requires manual control and is suitable for writing flexible web applications.

Ruby operates MySQL using mysql2 to connect to mysql and operate mysql. geminstallmysql2 connects to mysql to establish a connection: require'mysql2'conn=Mysql2::Client.new({host:'192.168.200.73',username:'root',password:'P@ssword1!'}) The accepted connection options include: Mysql2::Clie

How to use MySQL and Ruby to implement a simple data analysis report function Introduction: In today's data-driven era, data analysis plays a crucial role in corporate decision-making and development. As an important part of data analysis, data analysis reports are of great significance for organizing, visualizing and interpreting data. This article will introduce how to use MySQL and Ruby to implement a simple data analysis report function, and provide corresponding code examples. 1. Database design and table creation must realize data analysis and reporting functions
