Topic: Controller 404


I'm using apache2, RoR (ruby 1.8), and fcgi on ubuntu.

Few things to note:
- I've verified that .cgi and .fcgi script are processed by the server.
- The files in my rails project are all chmodded to 777 (just to make sure that isn't stopping me)

When I load my app, I get the "welcome to rails" page. If I click on "About your application's environment" I get "For security purposes, this information is only available to local requests." So that part of the application is working ok. (I'm not viewing from the local machine)

Now, I created a controller while in the root of the rails framework "script/create controller HelloWorld", and it creates the necessary files just fine. However, when I navigate to "http://www.my_website/Hello_World" I get nothing but a 404 "not found" page.

If I boot up the WEBrick web server, I get the same problem. The main page loads but nothing else will. The "application environment" loads the same (with the security message) on both apache2 and webrick.

Any ideas?

Re: Controller 404

Try restarting the apache server after you create the controller.

Also, you should be doing development on your local machine, not on the remote server. Use Capistrano to deploy the changes to the server.

Railscasts - Free Ruby on Rails Screencasts

Re: Controller 404

Thanks for your reply.

Restarting the server does not fix the problem.

I realize development should be done locally, but I am attempting to get a server running with ruby/rails so that it can eventually be a production "live" system with what I create locally.

To narrow down the situation/problem, my development log is giving me:
"ActionController::RoutingError (no route found to match "/HelloWorld" with {:method=>:get}):"

Now, I was able to make a controller load when specifying a default route in the route configuration, but this isn't going to be fun as I would have to manually define all routes. I want dynamic routes, not static.

Re: Controller 404

Well, this may sound stupid now, but in case someone else needs help, here is what the problem was:

The tmp/ folder was not writable, so the program crashes.

For anyone attempting to get RoR working, first make sure you can run cgi (fcgi on apache2) scripts. If you can't get that to work, consult more information on your webserver.

Once the CGI portion is working and the tmp/ folder is writable, well, cross your fingers and hope it works! A little restart of the webserver never hurts either (when installing/configuring your CGI modules)

Hope this helps.