404 Error in any controller/action on Media Temple

Hi everybody.

I’m a newbie on RoR. I have some experiencie developing in PHP or Java,
but I’m just starting with RoR.
A few days ago I signed up to the (gs) Grid Service on Media Temple.
This is my very first experience deplying RoR on a production
enviroment. Until now I just used the WebRick server on developement.

Well, the problem I’m having is that after installing the ruby_gems,
rails, mysql and the mongrel gems as indicated on the knowledge base of
media temple without any problem
(http://kb.mediatemple.net/article.php?id=140 ).
I’ve created a new RoR application, created the simbolic link, and
generated the .htaccess file just like the article indicates.

You can see the welcome page at here http://www.realwebs.com.ar/

When I clicked the link on the welcome page to see details about the
enviroment, http://www.realwebs.com.ar/rails/info/properties , I just
get the Rails 404 Error message.
It didn’t worried me, because I thinked that it would be due to security
rectrictions or something like that.

Then I used the console to create a new controller called test with an
action on it called index.

script/generate controller test index
  exists  app/controllers/
  exists  app/helpers/
  create  app/views/test
  exists  test/functional/
  create  app/controllers/test_controller.rb
  create  test/functional/test_controller_test.rb
  create  app/helpers/test_helper.rb
  create  app/views/test/index.rhtml

When i try to reach that controller with the web browser I keep getting
the 404 message. (http://www.realwebs.com.ar/test )

I checked the mongrel logs, and I don’t know much about mongrel, but I
googled a little and everything seems to be right in the mongrel.log:

** Daemonized, any open files are closed. Look at log/mongrel.pid and
log/mongrel.log for info.
** Starting Mongrel listening at 0.0.0.0:2011
** Starting Rails with production environment…
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
restart).
** Rails signals registered. HUP => reload (without restart). It might
not work well.
** Mongrel available at 0.0.0.0:2011
** Writing PID file to log/mongrel.pid

Then, I checked the production.log, and here seems to be the problem,
because I think mongrel isn’t routing the parameters in the requests:

Processing ApplicationController#index (for 200.127.42.218 at 2007-06-13
20:45:11) [GET]
Session ID: b811f7fd246057501ceb8069f2cd58dc
Parameters: {}

ActionController::RoutingError (no route found to match “/test” with
{:method=>:get}):
/home/20062/data/rubygems/gems/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1292:in
recognize_path' /home/20062/data/rubygems/gems/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1282:in recognize’
/home/20062/data/rubygems/gems/gems/rails-1.2.3/lib/dispatcher.rb:40:in
dispatch' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:78:in process’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:76:in
synchronize' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:76:in process’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:618:in
process_client' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:617:in each’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:617:in
process_client' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in
initialize' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in new’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in initialize’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in
new' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:271:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:270:in each’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:270:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/bin/mongrel_rails:127:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/command.rb:211:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/bin/mongrel_rails:243 /home/20062/data/rubygems/gems/bin/mongrel_rails:16:in load’
/home/20062/data/rubygems/gems/bin/mongrel_rails:16

Processing ApplicationController#index (for 200.127.42.218 at 2007-06-13
19:52:32) [GET]
Session ID: b811f7fd246057501ceb8069f2cd58dc
Parameters: {}

ActionController::RoutingError (no route found to match
“/rails/info/properties” with {:method=>:get}):
/home/20062/data/rubygems/gems/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1292:in
recognize_path' /home/20062/data/rubygems/gems/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1282:in recognize’
/home/20062/data/rubygems/gems/gems/rails-1.2.3/lib/dispatcher.rb:40:in
dispatch' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:78:in process’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:76:in
synchronize' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/rails.rb:76:in process’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:618:in
process_client' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:617:in each’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:617:in
process_client' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in
initialize' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in new’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:736:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in initialize’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in
new' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel.rb:720:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:271:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:270:in each’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/configurator.rb:270:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/bin/mongrel_rails:127:in run’
/home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/lib/mongrel/command.rb:211:in
run' /home/20062/data/rubygems/gems/gems/mongrel-1.0.1-i386-linux/bin/mongrel_rails:243 /home/20062/data/rubygems/gems/bin/mongrel_rails:16:in load’
/home/20062/data/rubygems/gems/bin/mongrel_rails:16

I mean, every request receive empty parameters:

Processing ApplicationController#index (for 200.127.42.218 at 2007-06-13
20:45:11) [GET]
Session ID: b811f7fd246057501ceb8069f2cd58dc
Parameters: {}

ActionController::RoutingError (no route found to match “/test” with
{:method=>:get}):

But in the browser I put the name of the controller after the slash,
I.E.: http://www.realwebs.com.ar/test

Here is the .htaccess file:

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
#MTSTART – Automatically generated, don’t modify –
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://10.2.134.220:2011/${escape:$1} [P]
#MTEND

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

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [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”

I think, that it seems to be right.

It would be any mongrel issue?
Please, could you give me a hand with this?

Thanks in advance, and sorry for my poor english.

What’s in your routes.rb file? Looks more like a rails routing issue
than mongrel to me.

On Jun 15, 1:25 pm, “Matías quaglia Matias” <rails-mailing-

Hi Cammo,

Thanks for replying,

What’s in your routes.rb file? Looks more like a rails routing issue
than mongrel to me.

Here is the routes.rb:

ActionController::Routing::Routes.draw do |map|

The priority is based upon order of creation: first created →

highest priority.

Sample of regular route:

map.connect ‘products/:id’, :controller => ‘catalog’, :action =>

‘view’

Keep in mind you can assign values other than :controller and

:action

Sample of named route:

map.purchase ‘products/:id/purchase’, :controller => ‘catalog’,

:action => ‘purchase’

This route can be invoked with purchase_url(:id => product.id)

You can have the root of your site routed by hooking up ‘’

– just remember to delete public/index.html.

map.connect ‘’, :controller => “welcome”

Allow downloading Web Service WSDL as a file with an extension

instead of a file named ‘wsdl’

map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’

Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’
end

It is like the default routes.rb when creating a new rails app.

It is supposed that
map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’

should route when I try to reach http://www.realwebs.com.ar/test, since
I created the controller with a default action named index.
If I try to get http://www.realwebs.com.ar/test/index I get 404 error
too.

Thanks for helping me.

I had this same problem with MediaTemple. I just fixed it five minutes
ago by accident: in the web based control panel, just reboot the RoR
container. I had the exact same issues you were describing and my
MT-provisioned files are the same. Hope this helps.

Thanks, Maxx

I had this same problem with MediaTemple. I just fixed it five minutes
ago by accident: in the web based control panel, just reboot the RoR
container. I had the exact same issues you were describing and my
MT-provisioned files are the same. Hope this helps.

I’ve already tried, disabling and re enabling the container.

When I used the reboot option I started to work.

Thank you!