Thread: Ruby and Apache

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    85
    Rep Power
    10

    Ruby and Apache


    Hi,

    I'm running Ruby on Rails on a Linux box, along with Apache 2.x. WEBRrick is a webservice that is packaged with Ruby, and I can display my Ruby pages when that service in running on the server. However, I CANNOT display anything when using just Apache as the web server. Apache has been configured, as far as we know, to work with Ruby. Anyone else having this problem?

    Thanks!!
    ~Snow
  2. #2
  3. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    WEBRick is for running a server in ruby. You need cgi for running it with apache. I've asked this be moved to the apache forum in case, since they're more likely to know.
  4. #3
  5. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Look into running FastCGI with RoR and Apache. Many times mod_cgi will be too slow for a RoR app.
  6. #4
  7. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    Originally Posted by Conundrum
    Look into running FastCGI with RoR and Apache. Many times mod_cgi will be too slow for a RoR app.
    I think you misunderstood my post. I meant the RUBY module CGI, not the apache one :-p
  8. #5
  9. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Originally Posted by LinuxPenguin
    I think you misunderstood my post. I meant the RUBY module CGI, not the apache one :-p
    Yep, I did. But I ran into another lower level problem trying to get a simple Ruby cgi script to work. I just installed Ruby and I can't even get "hello world" to work, even from the command line. I must be missing something.

    Shebang line: #!/usr/local/bin/ruby
    Works: /usr/local/bin/ruby test_ruby.cgi
    Doesn't work: ./test_ruby.cgi
    Result: : bad interpreter: No such file or directory

    Shebang line: #!/bin/env ruby
    Works: /bin/env ruby test_ruby.cgi
    Doesn't work: ./test_ruby.cgi
    Result: <line feed>

    Any help on getting it to work using the shebang line? This also causes problems in Apache.
    Last edited by Conundrum; June 2nd, 2006 at 03:04 PM.
  10. #6
  11. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    #!/usr/bin/env ruby works fine here... is it in your path? Is apache in a chroot?
  12. #7
  13. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    /usr/bin/env gives the same result for me as /bin/env (linefeed only). Are ruby scripts supposed to work from the command line as ./scriptname.rb ? Apache isn't chrooted. It's not working either but I'm just trying to get the script running from command using the shebang line interpreter first.
    Last edited by Conundrum; June 2nd, 2006 at 03:11 PM.
  14. #8
  15. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    yes, of course they are. i've been doing them like that for a few months now.

    I can't see how on earth that would happen...
  16. #9
  17. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,137
    Rep Power
    173
    Yeah, very strange. I'll look at it again later. Thx.
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    85
    Rep Power
    10
    Thanks for moving my post to the more appropriate section...

    We finally got it going with Apache - we did install the fast CGI and also had some permission problems, but we are up and running now.

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo