# RoR with apache2 on SuSE

**URL:** <https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279>\
**Category:** Rails\
**Created:** [September 19, 2006, 11:24pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279 "2006-09-19T23:24:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 19, 2006, 11:24pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/1 "2006-09-19T23:24:52Z")

</div>

Hi,  
I have an application completed that was built with RoR on windows. So  
this of course was tested with the webbrick server. I now want to put  
the project on our apache web server for production. I am having a very  
hard time getting this accomplished. I followed some of the steps here  
(because not all of them worked):  
[http://wiki.rubyonrails.com/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings](http://wiki.rubyonrails.com/rails/pages/HowtoSetupApacheWithFastCGIAndRubyBindings)  
And I have managed to get ruby, rails, fcgi, and mod\_fcgi all installed  
and working. I even have a test fcgi script that runs fine. However,  
I’m just not sure how to reference the project once it is on the server.  
With webbrick you just say localhost:3000/project\_name. But we can’t  
say [http://192.168.X.X/project\_name](http://192.168.X.X/project_name) on the apache web server because  
there is no index document. I can hit  
[http://192.168.X.X/project\_name/public](http://192.168.X.X/project_name/public) but when I click on about your  
applications environment I get this ugly output:

#!/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a  
log of unhandled # exceptions which forced the FastCGI instance to exit,  
great for debugging) # and the number of requests to process before  
running garbage collection. # # By default, the FastCGI crash log is  
RAILS\_ROOT/log/fastcgi.crash.log # and the GC period is nil (turned  
off). A reasonable number of requests # could range from 10-100  
depending on the memory footprint of your app. # # Example: # # Default  
log path, normal GC behavior. # RailsFCGIHandler.process! # # # Default  
log path, 50 requests between GC. # RailsFCGIHandler.process! nil, 50 #

# # Custom log path, normal GC behavior. # RailsFCGIHandler.process!

‘/var/log/myapp\_fcgi\_crash.log’ # require File.dirname( **FILE** ) +  
“/…/config/environment” require ‘fcgi\_handler’  
RailsFCGIHandler.process!

All of the tutorials that I find seem to say the same stuff, has anyone  
set this up before that could help?

thanks,

Tate

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 20, 2006, 4:51am UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/2 "2006-09-20T04:51:43Z")

</div>

Hi,

On Sep 19, 2006, at 2:24 PM, Tate H. wrote:

> [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/)  
> applications environment I get this ugly output:  
> Default  
> anyone  
> set this up before that could help?
> 
> thanks,
> 
> Tate

Last time I tried to set up Apache + FastCGI + Rails on SuSE, it  
didn’t work out so hot. Apache 2.2 is the default Apache version, and  
I couldn’t get mod\_fcgi and FastCGI installed and compiled happily.  
The situation may have changed, and someone who actually knows what  
they are doing could probably get it to work, but I ended up using  
fcgid, and that’s been fine.

If you want details about what I tried or have running now, let me know.

My advice to you – though, I haven’t done this on SuSE – is to go  
with mongrel. It’s much easier to set up and works great. You’ll also  
need something like pound out in front on a production site.

Scott

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 20, 2006, 5:20pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/3 "2006-09-20T17:20:24Z")

</div>

Yeah, if you could detail what you have and how it is working, that  
would be awesome. I have fcgid running and it does work because I can  
run a test script. But I would like to know how to get a ruby project  
up and running with this framework. It doesn’t even have to be the one  
that is already developed…I would be completely happy making a new  
project and seeing it run.

thanks,

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 20, 2006, 5:45pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/4 "2006-09-20T17:45:05Z")

</div>

If you’ve got apache 2.2, it makes a nice load balance in front of  
mongrel  
and mongrel\_cluster :

[http://mongrel.rubyforge.org/docs/apache.html](http://mongrel.rubyforge.org/docs/apache.html)

On 9/20/06, Tate H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Charles Brian Q.  
self-promotion: [www.seebq.com](http://www.seebq.com)  
highgroove studios: [www.highgroove.com](http://www.highgroove.com)  
slingshot rails hosting: [www.slingshothosting.com](http://www.slingshothosting.com)

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 4:52am UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/5 "2006-09-21T04:52:28Z")

</div>

On Sep 20, 2006, at 8:20 AM, Tate H. wrote:

> Yeah, if you could detail what you have and how it is working, that  
> would be awesome. I have fcgid running and it does work because I can  
> run a test script. But I would like to know how to get a ruby project  
> up and running with this framework. It doesn’t even have to be the  
> one  
> that is already developed…I would be completely happy making a new  
> project and seeing it run.

By “running with this framework,” you mean Mongrel + Apache? Take a  
look here: [http://mongrel.rubyforge.org/docs/apache.html](http://mongrel.rubyforge.org/docs/apache.html). I have a  
similar set-up on a BSD staging server, and I like it. Though I have  
to say that fcgid has done just fine on a moderately-high traffic site.

Here’s a summary of what I’ve got in production on SuSE 10.1:

apache2 2.2.0  
apache2-devel 2.2.0  
apache2-prefork 2.2.0  
libapr1 1.2.2  
libapr1-devel 1.2.2  
ruby 1.8.4  
FastCGI 2.4.0  
FastCGI-devel 2.4.0  
apache2-mod\_fcgid 1.07  
Ruby fcgi 0.8.7  
(ruby-fcgi 0.8.6 SuSE packages not installed)

/etc/sysconfig/apache2  
APACHE\_MODULES: fcgid

/etc/conf.d/mod\_fcgid.conf  
  
DefaultInitEnv RAILS\_ENV production  
SocketPath /tmp/fcgidsock  
AddHandler fcgid-script .fcgi  
IdleTimeOut 3600  
ProcessLifeTime 7200  
MaxProcessCount 8  
DefaultMaxClassProcessCount 3  
IPCConnectTimeout 20  
IPCCommTimeout 300

/etc/vhosts.d/obra.conf  
  
DocumentRoot /srv/www/rails/obra/current/public  
ErrorLog /srv/www/rails/obra/current/log/server.log  
UseCanonicalName On  
\<Directory “/srv/www/rails/obra”\>  
Options ExecCGI FollowSymLinks  
AllowOverride All  
Allow from all  
Order allow,deny

This is what I had before with Apache 2.0 and SuSE 10.0:  
/etc/conf.d/mod\_fastcgi.conf  
  
FastCgiIpcDir /tmp/fcgi\_ipc/  
FastCgiServer /srv/www/rails/obra/current/public/dispatch.fcgi -  
initial-env RAILS\_ENV=production -processes 6 -idle-timeout 60

BTW, thinking about your original post, does ‘RAILS\_ROOT/log/  
fastcgi.crash.log’ exist, and is it writable by your Apache user?

Scott

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/6 "2006-09-21T14:06:10Z")

</div>

Thanks for all of the help guys…I’ll try those links out.

Scott, that is roughly how I have my SuSE server set up. I’m just a  
little confused at how to access a new RoR project. Lets say my server  
ip is 192.168.1.80  
and I create a new project called test with “rails test”

Do I use [http://192.168.1.80/test/](http://192.168.1.80/test/) as the url?

There is no index document in there by default. Rails does have one at:  
[http://192.168.1.80/test/public/](http://192.168.1.80/test/public/)

But that is just a welcome page.

thanks again,

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 5:02am UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/7 "2006-09-21T05:02:47Z")

</div>

I’ve had really good luck with the instructions outlined here:

[http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

I did not do the Capistrano setup piece, and I used proxy-pass  
directives in httpd.conf instead of the various rewrite rules, but it’s  
speedy and flexible.

c.

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 3:44pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/8 "2006-09-21T15:44:47Z")

</div>

Put a symbolic link in your apache documents folder to  
\<rails\_dir\>/test/public. For instance (assuming file locations),

cd /usr/local/apache2/htdocs  
ln -s /var/rails/test/public ./test

Now you can access your rails application at [http://192.168.1.80/test/](http://192.168.1.80/test/)  
(assuming all other stuff being set up appropriately).

You’ll need to remove/rename the index document in the rails public  
folder.

c.

Tate H. wrote:

> Thanks for all of the help guys…I’ll try those links out.
> 
> Scott, that is roughly how I have my SuSE server set up. I’m just a  
> little confused at how to access a new RoR project. Lets say my server  
> ip is 192.168.1.80  
> and I create a new project called test with “rails test”
> 
> Do I use [http://192.168.1.80/test/](http://192.168.1.80/test/) as the url?
> 
> There is no index document in there by default. Rails does have one at:  
> [http://192.168.1.80/test/public/](http://192.168.1.80/test/public/)
> 
> But that is just a welcome page.
> 
> thanks again,

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 4:44pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/9 "2006-09-21T16:44:29Z")

</div>

Thanks guys,  
I got it going with mongrel behind my apache server.

thanks for all of the help!

---

<div class="post-metadata">

**Author:** ![Tate\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@Tate\_H](https://www.ruby-forum.com/u/Tate_H)\
**Post date:** [September 21, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/ror-with-apache2-on-suse/69279/10 "2006-09-21T15:39:53Z")

</div>

On Sep 21, 2006, at 5:06 AM, Tate H. wrote:

> There is no index document in there by default. Rails does have one  
> at:  
> [http://192.168.1.80/test/public/](http://192.168.1.80/test/public/)
> 
> But that is just a welcome page.
> 
> thanks again,

The Apache virtual host entry + Rails’ routes.rb determine the URL.  
RAILS\_ROOT/public is the root for static content. In your example,  
[http://192.168.1.80](http://192.168.1.80) will return the default public/index.html page.

With my example config:  
  
DocumentRoot /srv/www/rails/obra/current/public  
\<Directory “/srv/www/rails/obra”\>  
…

routes.rb:  
map.connect “/schedule/:year/:action”, :controller =\> “schedule”

So, [http://app.obra.org/schedule/2006/list](http://app.obra.org/schedule/2006/list) gets you to my  
ScheduleController’s list method. If you want to handle requests like  
[http://app.obra.org](http://app.obra.org), see the comments in routes.rb. If you want to  
set up different Rails projects in their own directories (e.g.,  
[http://www.obra.org/test\_project/](http://www.obra.org/test_project/)), you’ll need to set up Locations  
in your Apache config.

Scott
