# Deploying rails application on the Internet

**URL:** <https://www.ruby-forum.com/t/deploying-rails-application-on-the-internet/137699>\
**Category:** Deployment\
**Created:** [May 15, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/deploying-rails-application-on-the-internet/137699 "2008-05-15T14:00:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico10gbb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nico10gbb](https://www.ruby-forum.com/u/nico10gbb)\
**Post date:** [May 15, 2008, 2:00pm UTC](https://www.ruby-forum.com/t/deploying-rails-application-on-the-internet/137699/1 "2008-05-15T14:00:57Z")

</div>

I use Apache, Mongrel and Capistrano.

When I execute cap deploy it works fine.  
I have 2 Mongrel server running on the port 8000 et 8001.

Well, I have an important question now. I want get my rails  
application up  
on the Internet. The server herd is a web server. I have installed  
ruby and friends on the server.

This is a file, which I have created, in the folder sites-available of  
Apache on the server. This site is activated.

\<VirtualHost \*\>  
ServerName herd.ida.liu.se  
DocumentRoot /var/www/CoreSong/current/public

\<Directory “/var/www/CoreSong/current/public”\>  
Options FollowSymLinks  
AllowOverride None  
Order allow,deny  
Allow from all

\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://127.0.0.1:8000](http://127.0.0.1:8000)  
BalancerMember [http://127.0.0.1:8001](http://127.0.0.1:8001)  
BalancerMember [http://127.0.0.1:8002](http://127.0.0.1:8002)  
Allow from localhost

RewriteEngine On

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} -f  
RewriteRule (.\*) $1 [L]

ProxyPass / balancer://mongrel\_cluster/  
ProxyPassReverse / balancer://mongrel\_cluster/

# Deflate

AddOutputFilterByType DEFLATE text/html text/plain text/xml  
application/xml application/xhtml+xml text/javascript text/css  
BrowserMatch ^Mozilla/4 gzip-only-text/html  
BrowserMatch ^Mozilla/4.0[678] no-gzip  
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

ErrorLog /var/log/apache2/error.coresong.log  
CustomLog /var/log/apache2/access.coresong.log combined

Here is my deploy.rb file :

require ‘mongrel\_cluster/recipes’

set :user, “root”  
set :application, “CoreSong”  
set :repository, “[https://herd.ida.liu.se/svn/hcs/CoreSong](https://herd.ida.liu.se/svn/hcs/CoreSong)”

# If you aren’t deploying to /u/apps/#{application} on the target

# servers (which is the default), you can specify the actual location

# via the :deploy\_to variable:

set :deploy\_to, “/var/www/#{application}”

# If you aren’t using Subversion to manage your source code, specify

# your SCM below:

set :scm, :subversion  
set :deploy\_via, :export  
set :use\_sudo, false

ssh\_options[:port] = 22

role :app, “herd.ida.liu.se”  
role :web, “herd.ida.liu.se”  
role :db, “herd.ida.liu.se”, :primary =\> true

set :svn\_username, “s08nicma”  
set :svn\_password, “xxxxxx”

set :mongrel\_conf, “#{deploy\_to}/current/config/mongrel\_cluster.yml”  
set :runner, “root”

And here my mongrel\_cluster.yml :

cwd: /var/www/CoreSong/current  
log\_file: log/mongrel.log  
port: “8000”  
environment: production  
address: 127.0.0.1  
pid\_file: /var/www/CoreSong/shared/pids/mongrel.pid  
servers: 2

This configuration is good to get up the application on the Internet  
or I have forgotten something ?  
If this is good, what is the URL to test the web application from any  
machine ?

Thank you in advance for your help, which is very precious for a  
beginner like me ! 🙂

Nicolas

---

<div class="post-metadata">

**Author:** ![nico10gbb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nico10gbb](https://www.ruby-forum.com/u/nico10gbb)\
**Post date:** [May 22, 2008, 1:29pm UTC](https://www.ruby-forum.com/t/deploying-rails-application-on-the-internet/137699/2 "2008-05-22T13:29:22Z")

</div>

hi nicolas

\<VirtualHost :80\>  
ServerName herd.ida.liu.se

\<Proxy balancer://mongrels1\>  
BalancerMember [http://127.0.0.1:8000](http://127.0.0.1:8000)  
BalancerMember [http://127.0.0.1:8001](http://127.0.0.1:8001)

ProxyRequests Off

\<Proxy \*\>  
Order deny,allow  
Allow from all

# This allows you to manage the balancer-manager via the web

\<Location /balancer-manager\>  
SetHandler balancer-manager

RewriteEngine On

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} -f  
RewriteRule (.\*) $1 [L]

# Deflate

AddOutputFilterByType DEFLATE text/html text/plain text/xml  
application/xml application/xhtml+xml text/javascript text/css  
BrowserMatch ^Mozilla/4 gzip-only-text/html  
BrowserMatch ^Mozilla/4.0[678] no-gzip  
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

ProxyPass / balancer://mongrel\_cluster/  
ProxyPassReverse / balancer://mongrel\_cluster/  
ErrorLog /var/log/apache2/error.coresong.log  
CustomLog /var/log/apache2/access.coresong.log combined

by using this file in the folder sites-available of Apache. Then you can  
type your server name itself in the url for viewing.
