RubyOnRails with Apache2 and SCGI_Rails

  • Thread starter Michael Gebhart
  • Start date
M

Michael Gebhart

Hi,

I have a server running an apache2. I've decided to play around with ruby
on rails, so I wanted to install rails with apache2. My first idea was to
use fastcgi (mod_fastcgi), but this didn't work at all.

So I tried to get scgi_rails working:

Is it right, that scgi_rails is a server managing all the requests written
in ruby? the mod_scgi for apache is only for forwarding the requests of a
virtualhost to the internal port of scgi_rails? I don't understand how
scgi_rails could have enough performance to manage all the requests on a
often visited webpage. Apache is written in C, so I thought that managing
the requests in apache and using mod_fastcgi should be faster. Can you
explain why scgi_rails is fast enough and if I have understood it right,
that mod_scgi is only for forwarding the requests?

Well, now I've tried to install scgi_rails. And it is nearly working
correct. But I have still a few problems, maybe you can help me:

I've used this tutorial:
http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux

This is my virtualHost:

<VirtualHost myIP:80>
AddDefaultCharset utf-8
ServerName myDomain
DocumentRoot /srv/www/htdocs/myRailsDir/public
ErrorDocument 500 /500.html
ErrorDocument 404 /404.html
# handle all requests throug SCGI

SCGIMount /scgi-bin/ 127.0.0.1:9999

<Directory /srv/www/htdocs/myRailsDir/public>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

Can you tell me, what /scgi-bin/ is for?

I changed my .htaccess and changed the dispatch.fcgi line to:

RewriteRule ^(.*)$ /scgi-bin/$1 [QSA,L]

Now, when calling e.g. the method "hello" of my controller "say" I get
this message:


Unknown action
No action responded to hello.html

When deleting this line from the .htaccess:

RewriteRule ^([^.]+)$ $1.html [QSA]

it is working.

Do you know, where the problem is?


And: I always have to start scgi_rails manually. Is this the right way? Or
is there a chance to get apache starting the scgi_rails when it is needed?

Greetings

Mike
 
J

James Britt

Michael said:
Hi,

I have a server running an apache2. I've decided to play around with ruby
on rails, so I wanted to install rails with apache2. My first idea was to
use fastcgi (mod_fastcgi), but this didn't work at all.

So I tried to get scgi_rails working:

Is it right, that scgi_rails is a server managing all the requests written
in ruby? the mod_scgi for apache is only for forwarding the requests of a
virtualhost to the internal port of scgi_rails? I don't understand how
scgi_rails could have enough performance to manage all the requests on a
often visited webpage. Apache is written in C, so I thought that managing
the requests in apache and using mod_fastcgi should be faster. Can you
explain why scgi_rails is fast enough and if I have understood it right,
that mod_scgi is only for forwarding the requests?

Well, now I've tried to install scgi_rails. And it is nearly working
correct. But I have still a few problems, maybe you can help me:

I've used this tutorial:
http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux

Hmm. I've not seen that. I got scgi running using the HOWTO on Zed's
site. And it seemed pretty darn simple to do (thanks, Zed!)

http://www.zedshaw.com/projects/scgi_rails/howto.html
http://www.zedshaw.com/projects/scgi_rails/apache.html

This is my virtualHost:

<VirtualHost myIP:80>
AddDefaultCharset utf-8
ServerName myDomain
DocumentRoot /srv/www/htdocs/myRailsDir/public
ErrorDocument 500 /500.html
ErrorDocument 404 /404.html
# handle all requests throug SCGI

SCGIMount /scgi-bin/ 127.0.0.1:9999

<Directory /srv/www/htdocs/myRailsDir/public>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

Can you tell me, what /scgi-bin/ is for?

I think it is the root of your application.
e.g.
http://127.0.0.1/scgi-bin/somecontroller/someaction

I just used this:

SCGIMount /scgi-bin/ 127.0.0.1:9999

because I use

http://www.mydomain.com/somecontroller/someaction

I changed my .htaccess and changed the dispatch.fcgi line to:

RewriteRule ^(.*)$ /scgi-bin/$1 [QSA,L]

Now, when calling e.g. the method "hello" of my controller "say" I get
this message:


Unknown action
No action responded to hello.html

What is the exact URL you are trying? Does it end in .html?

actions called on controllers typically do not have any file extension
(you can munge that, but Rails by default assumes no extension is used).

James
--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
 

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,704
Messages
2,569,334
Members
44,617
Latest member
ConcettaTa

Latest Threads

Top