在一台专用服务器上运行两个不同的Rails应用程序 [英] Run two different Rails application on one dedicated server

查看:92
本文介绍了在一台专用服务器上运行两个不同的Rails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台具有以下配置的专用服务器

I have one dedicated server with below configurations

i3 - Dual Core - 3.06Ghz H/T
16GB RAM
500GB SATA2

现在,我想在一台专用服务器上执行两个不同的Rails应用程序。两种应用程序都不同,但是它们使用的是通用数据库。

Now I want to execute two different Rails application on one dedicated server. A both application are different but they are using common database.

有可能这样做吗?如果是,我该怎么做?
使用Apache的Phusion Passenger是一个好方法吗?如果是,如何用一个Phusion Passenger服务器配置两个应用程序?

Is it possible to do that? If yes – How can I do that? Is Phusion Passenger with Apache a good approach? If yes - How can I configure two application with one Phusion Passenger server?

推荐答案

我将描述如何在多个运行Rails的应用程序上运行。一台Linux服务器,使用Apache,Phusion Passenger和某些Ruby版本。您有很多选择,但这应该可以帮助您入门。其中许多细节来自安装脚本

I will describe how I run multiple Rails applications on one Linux server, using Apache, Phusion Passenger, and some version of Ruby. You have many choices, but this should help you get started. Many of these details come from the installation script

首先,安装Phusion Passenger。

First, install Phusion Passenger.

> gem install passenger

第二,构建Apache 2 Passenger模块。您应该能够执行在第一步中安装的以下脚本。

Second, build the Apache 2 Passenger module. You should be able to execute the following script installed during step one.

> passenger-install-apache2-module

此脚本将编译Apache 2模块并说明如何配置Apache 。如果缺少依赖项,脚本应提供一些有关如何安装依赖项的有用建议。

This script will compile the Apache 2 module and explain how to configure Apache. If dependencies are missing the script should offer some helpful advice about how to install them.

第三,编辑Apache配置文件。我必须添加这样的内容。 (只需使用它作为参考,不必担心.rvm)在第二步中运行的脚本将为您提供可以复制和粘贴的内容。

Third, edit your Apache configuration file. I have to add something like this. (Just use this for references and don't worry about .rvm) The script run in step two will give you something that you can copy and paste.

LoadModule passenger_module /Users/me/.rvm/gems/ree/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /Users/me/.rvm/gems/ree/gems/passenger-3.0.9
PassengerRuby /Users/me/.rvm/wrappers/ree/ruby

第四,为要运行的每个应用程序向您的Apache配置文件中添加类似的内容。

Fourth, add something like this to your Apache configuration file for each application you want to run.

<VirtualHost *:80>
  ServerName app1.example.com
  DocumentRoot /somewhere/app1/public    # <-- be sure to point to 'public'!
  <Directory /somewhere/app1/public>
     AllowOverride all              # <-- relax Apache security settings
     Options -MultiViews            # <-- MultiViews must be turned off
  </Directory>
</VirtualHost>

如果您有两个共享一个数据库的Rails应用程序,则它们在config / database中都将具有相似的连接信息.yml

If you have two Rails application sharing one database then they will both have similar connection information in config/database.yml

这篇关于在一台专用服务器上运行两个不同的Rails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆