Rails and Apache

S

slunky

I'm looking for a tutorial or some tips on getting RoR to play nice with
Apache. This is a virtual host, and I have access to my httpd.conf. I've
looked at a few, but they're all very vague. The tutorial on
wiki.rubyonails.com just confuses me. Does anyone have an idea on how to
get it to work? Maybe I should ask on an Apache group?
 
G

gregarican

slunky said:
I'm looking for a tutorial or some tips on getting RoR to play nice with
Apache. This is a virtual host, and I have access to my httpd.conf. I've
looked at a few, but they're all very vague. The tutorial on
wiki.rubyonails.com just confuses me. Does anyone have an idea on how to
get it to work? Maybe I should ask on an Apache group?


Are you talking about this tutorial -->
http://wiki.rubyonrails.org/rails/pages/Tutorial ? It goes through what
to put into the Apache configuration file so that the Rails app folders
can be accessed. Then you can increase performance via tweaking the CGI
by switching over to FastCGI. This is done by changing a Rails dispatch
configuration file.

I haven't setup Rails on Apache in awhile (like almost a year now) but
IIRC it wasn't too involved once everything was installed. I also
recommend posting this question to the Rails mailing list
(http://lists.rubyonrails.org/mailman/listinfo) as your replies might
come quicker.
 
S

slunky

_/ gregarican wrote \_
Are you talking about this tutorial -->
http://wiki.rubyonrails.org/rails/pages/Tutorial ?

That's the one. I don't understand what to put under path/application/
Do I link it to the app/ directory?
It goes through what
to put into the Apache configuration file so that the Rails app folders
can be accessed. Then you can increase performance via tweaking the CGI
by switching over to FastCGI. This is done by changing a Rails dispatch
configuration file.

I'll try that tool.
I haven't setup Rails on Apache in awhile (like almost a year now) but
IIRC it wasn't too involved once everything was installed. I also
recommend posting this question to the Rails mailing list
(http://lists.rubyonrails.org/mailman/listinfo) as your replies might
come quicker.

I prefer newsgroups, but if I get desperate I will. Thanks for the info.
I think I'll just set it down. I've been working on this for two days,
and maybe I just need a chear head.
 
G

gregarican

Here are some pertinent lines from my httpd.conf file:

httpd.conf
--------------

<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>

<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
RubyRequire apache/eruby-run
</IfModule>

# exec files under /ruby as ruby scripts
<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI
</Location>

# handle files under /eruby as eRuby files
<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Location>

# exec *.rbx as ruby scripts
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>

# handle *.rhtml files as eRuby files
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>

<VirtualHost *:8080>
ServerAdmin (e-mail address removed)
ServerName rails
DocumentRoot "c:/program files/apache
group/apache2/htdocs/po/public"
ErrorLog logs/rails_error.log
<Directory "c:/program files/apache
group/apache2/htdocs/po/public">
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from 10.0.0.0/255.255.0.0
</Directory>
</VirtualHost>

So you would point the Apache server to your public folder created
under your Rails application name. In my case I have a 'po' Rails app
name (it's a purchase order app), so I point Apache to .../po/public.
The allow/deny stuff allows only local private IP's to conenct to my
Rails virtual host.

The other lines in the config file mostly setup how Apache processes
Ruby code embedded in its web content. Is this becoming any clearer?
 
M

Morten

Apache is easy to setup with SCGI.
http://wiki.rubyonrails.org/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux

Alternatively, it's even simpler to run Rails using Mongrel and ProxyPass:

<VirtualHost a.b.c.d>
ServerName www.mydomain.com
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
I prefer newsgroups, but if I get desperate I will. Thanks for the info.
I think I'll just set it down. I've been working on this for two days,
and maybe I just need a chear head.

Check out gmane.org for a newsgroup (NNTP) interface to lots and lots of
mailing lists.

Morten
 
S

slunky

_/ Morten wrote \_
Apache is easy to setup with SCGI.
http://wiki.rubyonrails.org/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux

Alternatively, it's even simpler to run Rails using Mongrel and ProxyPass:

Problem with that is I'm not an administrator on this system, I only
have Apache and FastCGI, and could request more packages, but probably
nothing as grand as a new http server.
Check out gmane.org for a newsgroup (NNTP) interface to lots and lots of
mailing lists.

I will. Thanks.
 
S

slunky

Ruby code embedded in its web content. Is this becoming any clearer?

Yes, this has been a great help. I'm going to try it out tommorrow, and
I'll get back and make sure to share my configuration. There doesn't
seem to be a lot this type of thing out there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top