# Rails on Apache

**URL:** <https://www.ruby-forum.com/t/rails-on-apache/47899>\
**Category:** Rails\
**Created:** [November 15, 2005, 12:05am UTC](https://www.ruby-forum.com/t/rails-on-apache/47899 "2005-11-15T00:05:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 12:05am UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/1 "2005-11-15T00:05:42Z")

</div>

Hi all,

I’m new to rails (and ruby) so be kind 🙂

I have a small server running W2K on which apache (2.0.x) is running  
with  
the latest version of ruby and rails (I followed the howto on  
[rubyonrails.org](http://rubyonrails.org) [http://rubyonrails.org](http://rubyonrails.org)). However, I want to do the  
following:  
I have a domain ([www.domain.org](http://www.domain.org) [http://www.domain.org](http://www.domain.org)) configured on  
the  
server as follows:  
\<VirtualHost \*:80\>  
ServerAdmin removed\_email\_address@domain.invalid  
DocumentRoot D:/data/www/domain.org  
ServerName [www.domain.org](http://www.domain.org) [http://www.domain.org](http://www.domain.org)  
ErrorLog logs/www.domain.org-error\_log  
CustomLog logs/www.domain.org-access\_log common  
Alias /h2o d:/data/www/rails.domain.org/h2o/public/  
\<Directory “d:/data/www/rails.domain.org/h2o/public/”\>  
Options ExecCGI FollowSymLinks  
AllowOverride all  
Allow from all  
Order allow,deny  
AddHandler cgi-script .cgi  
AddHandler fastcgi-script .fcgi

What I want to do is to serve the h2o application from a different  
documentroot than the normal website (which is plain html). No, I don’t  
know  
if this makes sense or not but bear with me if it remotely does 🙂

The dispatch.fcgi in the public folder has as first line  
#!D:/data/apps/ruby/bin/rubyw  
As mentioned in the HOWTO

The .htaccess file looks lik this:

# General Apache options

AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI

# If you don’t want Rails to look in certain directories,

# use the following rewrite rules so that Apache won’t rewrite certain

requests

# 

# Example:

# RewriteCond %{REQUEST\_URI} ^/notrails.\*

# RewriteRule .\* - [L]

# Redirect all requests not available on the filesystem to Rails

# By default the cgi dispatcher is used which is very slow

# 

# For better performance replace the dispatcher with the fastcgi one

# 

# Example:

# RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

RewriteEngine On

# If your Rails application is accessed via an Alias directive,

# then you MUST also set the RewriteBase in this htaccess file.

# 

# Example:

# Alias /myrailsapp /path/to/myrailsapp/public

# RewriteBase /myrailsapp

#Alias /h2o d:/data/www/rails.apro.be/h2o/public/  
RewriteBase /h2o

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors

# Instead of displaying this message you can supply a file here which

will  
be rendered instead

# 

# Example:

# ErrorDocument 500 /500.html

ErrorDocument 500 “

## Application error
Rails application failed to  
start properly”

Now, the problem is that the application does not work. The URL to start  
is  
htt://www.domain.org/h2o/account/login. However, this page gives me a  
timeout in the logs.

Can someone help me with this?

Many thanks!

BB  
Peter

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 5:00pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/2 "2005-11-15T17:00:12Z")

</div>

Someone correct me if I’m wrong, but as far as I know Apache 2.0.x is  
not very stable with fastcgi. People usually find Apache 1.3.x works  
better.

My personal preference is to use “ruby script/server” for  
development, and lighttpd on the production server (I have a Virtual  
Private Server).

Apache only gave me headaches.

That doesn’t exactly help you out with your issue, just a tip 🙂  
cheers, Rob

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 4:11pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/3 "2005-11-15T16:11:57Z")

</div>

Hi all,

I’m new to rails (and ruby) so be kind 🙂

I have a small server running W2K on which apache (2.0.x) is running  
with  
the latest version of ruby and rails (I followed the howto on  
[rubyonrails.org](http://rubyonrails.org) [http://rubyonrails.org](http://rubyonrails.org)). However, I want to do the  
following:  
I have a domain ([www.domain.org](http://www.domain.org) [http://www.domain.org](http://www.domain.org)) configured on  
the  
server as follows:  
\<VirtualHost \*:80\>  
ServerAdmin removed\_email\_address@domain.invalid  
DocumentRoot D:/data/www/domain.org  
ServerName [www.domain.org](http://www.domain.org) [http://www.domain.org](http://www.domain.org)  
ErrorLog logs/www.domain.org-error\_log  
CustomLog logs/www.domain.org-access\_log common  
Alias /h2o d:/data/www/rails.domain.org/h2o/public/  
\<Directory “d:/data/www/rails.domain.org/h2o/public/”\>  
Options ExecCGI FollowSymLinks  
AllowOverride all  
Allow from all  
Order allow,deny  
AddHandler cgi-script .cgi  
AddHandler fastcgi-script .fcgi

What I want to do is to serve the h2o application from a different  
documentroot than the normal website (which is plain html). No, I don’t  
know  
if this makes sense or not but bear with me if it remotely does 🙂

The dispatch.fcgi in the public folder has as first line  
#!D:/data/apps/ruby/bin/rubyw  
As mentioned in the HOWTO

The .htaccess file looks lik this:

# General Apache options

AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI

# If you don’t want Rails to look in certain directories,

# use the following rewrite rules so that Apache won’t rewrite certain

requests

# 

# Example:

# RewriteCond %{REQUEST\_URI} ^/notrails.\*

# RewriteRule .\* - [L]

# Redirect all requests not available on the filesystem to Rails

# By default the cgi dispatcher is used which is very slow

# 

# For better performance replace the dispatcher with the fastcgi one

# 

# Example:

# RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

RewriteEngine On

# If your Rails application is accessed via an Alias directive,

# then you MUST also set the RewriteBase in this htaccess file.

# 

# Example:

# Alias /myrailsapp /path/to/myrailsapp/public

# RewriteBase /myrailsapp

#Alias /h2o d:/data/www/rails.apro.be/h2o/public/  
RewriteBase /h2o

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors

# Instead of displaying this message you can supply a file here which

will  
be rendered instead

# 

# Example:

# ErrorDocument 500 /500.html

ErrorDocument 500 “

## Application error
Rails application failed to  
start properly”

Now, the problem is that the application does not work. The URL to start  
is  
htt://www.domain.org/h2o/account/login. However, this page gives me a  
timeout in the logs.

Can someone help me with this?

Many thanks!

BB  
Peter

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 10:44pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/4 "2005-11-15T22:44:18Z")

</div>

On 11/15/05, Robert [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Someone correct me if I’m wrong, but as far as I know Apache 2.0.x is  
> not very stable with fastcgi. People usually find Apache 1.3.x works  
> better.

Apache 2.0 works fine with fastcgid (not fastcgi), which kills old  
fastcgi process.

I use a frontend apache because I want to deliver compressed page  
through mod\_gzip, and as far as I’ve seen it, lighttpd doesn’t support  
that (someone confirm?).

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 11:20pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/5 "2005-11-15T23:20:26Z")

</div>

Can someone tell me a host where I can deploy a Rails app?  
What is the easiest way to do this?  
Am I stuck with a colocated server or are there hosted platforms that  
make  
it easier to deploy and scale?  
Anyone?  
Thanks in advance!  
John B  
PS - I know this has multiple answers - just looking for opinions…

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 11:26pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/6 "2005-11-15T23:26:28Z")

</div>

On 15 Nov 2005, at 22:16, speechexpert wrote:

> Can someone tell me a host where I can deploy a Rails app?  
> What is the easiest way to do this?  
> Am I stuck with a colocated server or are there hosted platforms  
> that make it easier to deploy and scale?  
> Anyone?  
> Thanks in advance!

At the moment I know of planet argon and Xeriom.  
We’re still testing our Rails platform so you might be better going  
for them:

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

## Yours, Craig

Craig W. | t: +44 (0)131 516 8595 | e: removed\_email\_address@domain.invalid  
[Xeriom.NET](http://Xeriom.NET) | f: +44 (0)709 287 1902 | w: [http://xeriom.net](http://xeriom.net)

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 11:47pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/7 "2005-11-15T23:47:33Z")

</div>

On Tue, 2005-11-15 at 22:24 +0000, Craig W. wrote:

> for them:  
> [http://www.planetargon.com/](http://www.planetargon.com/)

You can ping us on IRC as well…

#planetargon on [irc.freenode.net](http://irc.freenode.net)…

or via our site:

- [Get In Touch - Planet Argon](http://www.planetargon.com/chat.html)

We don’t just hand you the keys to your ssh account and wish you luck…  
we’ll help make sure your site is running smoothly. (been known to even  
assist with making a few code changes to help optimize client  
applications).

[Page Not Found (404) - Planet Argon](http://www.planetargon.com/hosting.html) (rates/plans)

Also, we’ve recently begun offering private IP addresses for +$3/mo so  
that you can run Lighttpd on your own port WITHOUT mod\_proxy through our  
Apache servers. It makes Rails apps just a tad bit faster. 😃

I’ve heard good things about Site5 ([www.site5.com](http://www.site5.com)) as well… but they  
don’t offer PostgreSQL. 😉

Good luck on your quest for good hosting. I know it can be tough.

Cheers,

-Robby

–  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

- Robby R., Founder.Developer.Geek
- PLANET ARGON, Rails Development, Consulting & Hosting
- Portland, Oregon | p: 503.351.4730 | f: 815.642.4068
- [www.planetargon.com](http://www.planetargon.com) | [www.robbyonrails.com](http://www.robbyonrails.com)
- Programming Rails | [www.programmingrails.com](http://www.programmingrails.com)  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

---

<div class="post-metadata">

**Author:** ![pverhoye](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dfb087/32.png) [@pverhoye](https://www.ruby-forum.com/u/pverhoye)\
**Post date:** [November 15, 2005, 5:42pm UTC](https://www.ruby-forum.com/t/rails-on-apache/47899/8 "2005-11-15T17:42:22Z")

</div>

I haven’t had any problems with Apache2 and fastcgi at all, both on my  
iBook (development environment) and on the host where it runs (AMD64  
box running Apache2 under Gentoo Linux).

I’ve been having far more difficulty getting lighttpd to work properly  
on my iBook with a slightly non-standard (read: no examples on the  
net) configuration.

On 11/15/05, Robert [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That doesn’t exactly help you out with your issue, just a tip 🙂  
> cheers, Rob
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Chris H.

@TheBallpark - [http://www.littlehart.net/attheballpark](http://www.littlehart.net/attheballpark)  
@TheKeyboard - [http://www.littlehart.net/atthekeyboard](http://www.littlehart.net/atthekeyboard)
