- 浏览: 852215 次
- 性别:
- 来自: lanzhou
文章分类
最新评论
-
liu346435400:
楼主讲了实话啊,中国程序员的现状,也是只见中国程序员拼死拼活的 ...
中国的程序员为什么这么辛苦 -
qw8226718:
国内ASP.NET下功能比较完善,优化比较好的Spacebui ...
国内外开源sns源码大全 -
dotjar:
敢问兰州的大哥,Prism 现在在12.04LTS上可用么?我 ...
最佳 Ubuntu 下 WebQQ 聊天体验 -
coralsea:
兄弟,卫星通信不是这么简单的,单向接收卫星广播信号不需要太大的 ...
Google 上网 -
txin0814:
我成功安装chrome frame后 在IE地址栏前加上cf: ...
IE中使用Google Chrome Frame运行HTML 5
Installing Ruby on Rails with Apache on Ubuntu 9.04 (Jaunty)
- 博客分类:
- DoingRails
Installing Passenger and Dependencies
Before we get started there are a number of system-level dependencies that you will almost certainly need as you begin deploying your Rails app. Lets get them out of the way at the beginning:
apt-get install make build-essential
We going to add a repository to our /etc/apt/sources.list to install pakages of Passenger from Ubuntu's "universe" repository. Add the following lines to your sources.list with the text editor of your choice:
File: /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty universe
When you've saved this file, you will need to rebuild the package database:
apt-get update
The collection of dependencies and extra software you install at this point will depend on your requirements. Ubuntu's package management tool will automatically download all required dependencies for the software you install. We'll begin by installing Ruby gems (for installing additional Ruby packages), the development packages for Ruby, and the Phusion passenger module for Apache 2.
apt-get install libapache2-mod-passenger rubygems ruby1.8-dev
You will also want to install the fastthread Ruby gem:
gem install fastthread
This should install the latest versions of all packages, including ruby, rake, rack, and other dependencies needed for basic Rals development. Additional dependencies may also include:
-
the OpenSSL library for Ruby.
apt-get install libopensssl-ruby
-
other dependencies required by the application you wish to deploy.
Configuring Apache to Work with Passenger
Passenger should be installed by default following the installation using apt-get, you can verify this by checking the contents of the /etc/apache2/mods-enabled directory with the following command:
ls /etc/apache2/mods-enabled/passenger*
The output of this should look like this:
passenger.conf passenger.load
These files load and enable the Passenger module for use in your sites. If you configured Apache virtual hosting as outlined in the Ubuntu Jaunty Apache guide, the public directory for your domain (e.g. ducklington.org) is located in /srv/www/ducklington.org/public_html/, and your <VirtualHost > configuration block contains a line that reads:
File excerpt: Apache Virtual Host Configuration
DocumentRoot /srv/www/ducklington.org/public_html/
In typical Passenger-based Rails deployments the application directory would be located in /srv/www/ducklington.org/; for example my-app/ would be located at /srv/www/ducklington.org/my-app/ and we would symbolically link (symlink) the my-app/public/ folder to /srv/www/ducklington/public_html/. We'll begin by removing the current public_html/ directory if it already exists:
rmdir /srv/www/ducklington.orgn/public_html/
Then we'll create the symbolic link:
ln -s /srv/www/ducklington.org/my-app/public/ /srv/www/ducklington.org/public_html/
We'll want to restart Apache once to make sure all of our settings and configurations have been loaded:
/etc/init.d/apache2 restart
Note: Passenger requires that the log files in your application be world writable (eg. chmod 666) and will produce an HTTP 500 Internal Server Error if the log files are not writable. Issue the following command to change the permissions of the files in the log directory of the "lollipop" application in the setup above.
chomd 666 /srv/www/ducklington.org/lollipop/log/*
You now have a functioning environment for your Ruby on Rails application.
Deploying Multiple Rails Apps
If you need to install multiple Rails applications the easiest way to accomplish this is by installing each application in its own virtual host. Create multiple virtual hosts, as described in Guide for Using Apache in Jaunty and link the public/ directory of your application to the DocumentRoot (e.g. public_html/) of the virtual host, as described above.
This presents a number of advantages. The Apache mpm_itk module (described in the Apache Guide) allows you to isolate the permissions of each running application from Apache and each other. Furthermore, virtual hosting allows you to separate all log files for each host (and thus application) from the other applications and sites on your server.
Passenger also supports deploying more than one Rails application within a single virtual host configuration. By adding RailsBaseURI options with the path to your Application within the virtual host, you can deploy multiple applications within one site. For example:
File excerpt: Apache Virtual Host Configuration
DocumentRoot /srv/www/ducklington.org/public_html/ RailsBaseURI /lollipop RailsBaseURI /frogs RailsBaseURI /simon
These lines, taken from a fictitious <VirtualHost > tell Passenger about three Rails apps in the ducklington.org host. Rather than linking the public/ directory of your Rails app to the public_html/ directory of the Host, we'll link the public directory of the application to a folder below the public_html/ directory. In this example the following commands will create the necessary symbolic links:
ln -s /srv/www/ducklington.org/lollipop/public/ /srv/www/ducklington.org/public_html/lollipop/ ln -s /srv/www/ducklington.org/lollipop/frogs/ /srv/www/ducklington.org/public_html/frogs/ ln -s /srv/www/ducklington.org/lollipop/simon/ /srv/www/ducklington.org/public_html/simon/
In this setup the directories for each Rails application are located in the /srv/www/ducklington.org/ directory, which is not accessible to the web server. In practice, the application directories could be located wherever you like.
发表评论
-
Rails 3 Beta版本月将出 Merb融合带来选择
2010-01-11 09:48 1424Rails 3,目前流行Web开发框架Rails的一个升级版 ... -
MerbAdmin:Merb数据管理好帮手
2010-01-11 09:43 910Merb中要加入类似Django的Admin功能早有传闻,如今 ... -
rails cms
2009-12-28 20:29 1672Rails CMS alternatives ======= ... -
Generating Thousands of PDFs on EC2 with Ruby
2009-12-24 18:01 1045The Problem For about two mont ... -
Shrink your JavaScript with the Google Compiler Rails Plugin
2009-11-16 11:27 937Like it or not, JavaScript has ... -
Thank you, Rails
2009-11-06 18:21 570It’s fashionable, or perhaps in ... -
Top 50 Ruby on Rails Websites
2009-10-31 15:18 949We’re big fans of Ruby on Rails ... -
Let a human test your app, not (just) unit tests
2009-10-31 09:26 862I’m a big believer in unit test ... -
Heroku Gets Add-Ons: Serious Ruby Webapp Hosting Made Easy
2009-10-30 07:37 917Heroku is a Ruby webapp hosti ... -
Rails + Google Analytics = easy goal tracking
2009-10-29 20:38 898Google Analytics is an indis ... -
Integrating Flickr into your rails website
2009-10-29 20:37 1072In this post I’m going to show ... -
Ruby on Rails Roadshow in Austin Thursday
2009-10-29 14:25 811Justin Britten founded Prefine ... -
Ruby on Rails and the importance of being stupid
2009-10-21 08:13 814A tale of two servers… Server ... -
How a 1-Engineer Rails Site Scaled to 10 Million Requests Per Day
2009-10-20 14:49 780Ravelry is an online knitting ... -
Installing Rails on CentOS 5
2009-10-20 14:24 1200Note: Since this post origina ... -
CentOS配置lighttpd和rails
2009-10-20 14:22 1129lighttpd版本:1.4.18 fastcgi版本: ... -
Cells:将组件开发带入Ruby2.3
2009-10-20 09:17 1121cells "将使得面向组 ... -
High Quality Ruby on Rails Example Applications
2009-10-15 16:34 1469Sometimes to best way to get ... -
Install Passenger on Ubuntu
2009-10-07 10:17 811Phusion Passenger is one of the ... -
Ruby on Rails with Nginx on Ubuntu 9.04 (Jaunty)
2009-10-07 09:57 1070Install Required Packages ...
相关推荐
Ruby on Rails is the revolutionary online programming tool that makes creating functional e-commerce web sites faster and easier than ever. With the intuitive, straightforward nature of Ruby and the ...
OpenERP Installing Ubuntu9.04
标题与描述均提到了“ruby on rails安装环境”,这表明文档主要关注的是如何在特定的环境中设置Ruby on Rails。Ruby on Rails(常简称为Rails)是一种用于开发Web应用程序的开源框架,采用Ruby语言编写,遵循MVC...
- Installing Rails on Windows requires setting up Ruby, installing gems like `bundler`, and configuring the environment. Developers often use tools like RubyInstaller and DevKit for Windows. 2. **...
# SAP Ruby on Rails with AJAX: An In-depth Exploration ## Introduction The integration of SAP and Ruby on Rails has sparked considerable interest in the IT community, leading to the development of ...
Auth0 + Ruby on Rails WebApp种子+示例 该项目的目标是帮助将Auth0功能集成到Ruby on Rails应用程序中。 您可以在了解有关种子项目和示例的更多信息。 解决问题 如果在Mac上收到以下错误,请执行以下操作: An ...
面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...
Many former Java developers still use Ruby on Rails today, the most popular framework for building Ruby applications. What You'll Learn What are the fundamentals of Ruby and its object-oriented ...
Ubuntu用户通常会依赖于包管理工具`apt-get`来安装Ruby,这种方式虽然简单便捷,但在某些情况下可能无法满足定制化的需求。本文将详细介绍如何通过手动编译的方式安装Ruby,并提供一种灵活的升级策略。 #### 手动...
### 安装Anaconda在Ubuntu上的详细步骤及关键知识点 #### 一、Anaconda简介 Anaconda是一款非常受欢迎的数据科学平台,它集成了Python或R语言环境中的许多库和工具,便于用户进行数据处理、科学计算、机器学习等...
Installing the Ubuntu Server Chapter 3. Usage Basics: Login, Interfaces, and Help Chapter 4. Managing Software Part 2: Services Chapter 5. Managing Services with systemd Chapter 6. Mail Servers ...
### 安装STLinux在Ubuntu上的关键步骤与挑战 #### 概览 本文将深入探讨在Ubuntu上安装STLinux的全过程,重点解析由于包管理系统的差异而带来的挑战及其解决方案。对于那些希望在Ubuntu环境中利用STLinux强大功能的...
Starting with installing Kubernetes on a single node, the book introduces Kubernetes with a simple Hello example and discusses using environment variables in Kubernetes. Next, the book discusses using...
如果您熟悉 Ruby on Rails 等 Web 框架,我们会采用许多相同的原则并将它们应用于我们的平台。 特别是,我们的 SDK 可以开箱即用,您只需进行最少的配置。 在 Parse 上,您为每个移动应用程序创建一个应用程序。 ...
Installing and Configuring Openfiler with DRBD and Heartbeat