2
votes

Env:

  • OpenSUSE 11.4
  • Apache 2.2.17
  • Passenger 3.0.18
  • Ruby 1.8.7
  • Rails 3.2.8

I have already installed RoR application under apache - ChiliProject (but using rails 2.3.14) and it works fine.

It's installed in /chiliproject and In httpd config (actually in default-server since I don't have vhosts) I have "RailsBaseURI /chiliproject/public".

Now, I need to develop own application (first experience in web developing).

"rails new hello_world", Webrick works fine, but I want to run it under apache with CGI. I added "RailsBaseURI /hello_world/public". But it doesn't work properly. When I press "About your application environment" on index page it gives me 404 "The page you were looking for doesn't exist.". For any routes in rails it gives either error 500 or 404. But same routes and controllers work fine with webrick. And even if I put ChiliProject into /hello_world it works. This means that problem is not with apache or passenger.

No apache/passenger errors in log, just 404 or 500. I tried "rails 2.4.13 new hello_world" but it gives me a lot of errors and simple googling doesn't solve all of them. So, I can't easily create a new project with rails 2.4.13 which works fine with another app and I don't think it can help.

I read on the ruby website that 1.8.7 may cause crashes with rails3. After that I spent 4 hours working around RVM and different ruby versions. After all, ChiliProject (even latest version) doesn't work with ruby 1.9 and my original problem did not gone. Now I have all thing back (ruby 1.8.7 from distro's repo and no RVM).

1
I am not sure, but I think you need ruby 1.9.2 or higher for Rails 3.2. But first, if you're at "Hello world" stick with the standard rails server (webrick) for now. There's a LOT to learn, and you have about 20 different things that might be going wrong -- isolate out little components and you'll be much better off (and you'll also be able to write more specific questions that people on Stack Overflow can actually answer :-).Tom Harrison
I tried Ruby 1.9.3 - nothing changedOleg Antonyan
I know that this bad question, but I can't make it more specific. Maybe you can help me asking specific questions. If you think webrick is better now - OK, but I need CGI scripts in my aplication (to communicate with daemon and hardware). Could you please point me to tutorial how to enable CGI execution in webrick?Oleg Antonyan
Forget CGI. Webrick ("rails server") is a fine web server for development. Apache or NGinx are common web servers used in production. Both offer modules allowing connections, including Phusion Passenger (works with both). There are many combinations, but my main point was you need to start with a small, specific problem, what you've tried, and specific errors. Otherwise you'll get answers from cranky people who tell you to read the manual and such.Tom Harrison

1 Answers

5
votes

If your webbrick works, big change something wrong with your apache config file.

I use bitnami RubyStack and config below without any issues:

<VirtualHost *:80>
    ServerName www.myhostname.com
    DocumentRoot /home/bitnami/app_name/public  
    RailsEnv development
    <Directory /home/bitnami/app_name/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

My Passenger version:

:~$sudo passenger-config --root
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.17

Please check if passenger is running:

:~$sudo passenger-status

----------- General information -----------
max      = 6
count    = 2
active   = 0
inactive = 2
Waiting on global queue: 0

----------- Application groups -----------
/home/bitnami/app_1:
  App root: /home/bitnami/app_1
  * PID: 4972    Sessions: 0    Processed: 24      Uptime: 33h 38m 14s

/home/bitnami/app_2:
  App root: /home/bitnami/app_2
  * PID: 24538   Sessions: 0    Processed: 1682    Uptime: 296h 14m 44s