SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Configuring RoR/Apache -- help?

    All right, I got FastCGI and RoR installed...

    Questions:

    Should Rails apps really live in /home/user/ and not /home/user/public_html?

    In the main server configuration I have:
    <IfModule mod_fastcgi.c>
    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi
    </IfModule>

    Do I need to have <Directory> sections in the <VirtualHost> section for each Rails app?

    The Agile book talks about a different configuration for FastCGI, but can that <IfModule> section be used within, say, my <Directory> tags in httpd.conf, or in an .htaccess file?

    What else do I need to do to get this to work?

  2. #2
    SitePoint Member
    Join Date
    May 2006
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know the specifics for this...

    But however, I suggest you ask at http://www.ruby-forum.com/ as it is a forum in sync with the mailing list for ruby developers.

    Best of luck

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Yes, IfModule can be used within the Directory tags or in .htaccess.

    Of course, you shouldn't need an IfModule by the time it gets to your app's .htaccess, assuming you have FastCGI set up correctly in the first place.

  4. #4
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The line in Agile is:

    FastCGIServer /path/to/app/public/dispatch.fcgi \
    -initial-env RAILS_ENV=production \
    - processes 15 -idle-timeout 60

    I wouldn't want that in my main server configuration, right? I would think ideally I would want that in the .htaccess file, out of httpd.conf entirely, so that users could handle it themselves.

    Anyway, I got to the Welcome Aboard page (public/index.html) but anything requiring dispatch.fcgi is taking me to 500.html.

    The log says things like:

    Recognition failed for "/dispatch.fcgi/"
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:488:in `recognition_failed'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:478:in `recognize!'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in `process_request'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in `process!'
    /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
    /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in `process!'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in `process!'

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You shouldn't be trying to access dispatch.fcgi in the browser.

    Is there a fastcgi.crash.log file anywhere? What does that say?

  6. #6
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wasn't trying to access dispatch.fcgi directly... that was from accessing myurl.com/railstest/testcontroller

    I see that when I change .htaccess to use regular cgi instead of fastcgi, RoR seems to be working... I can access that same url and see what I expect to see ("hello world" )

    There isn't a fastcgi.crash.log in the application log folder. Anywhere else I might look for it?

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Maybe in Apache's logs directory? Also look for a file called error.log in the Apache logs directory, there may be some information there.

  8. #8
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LOL:

    Couldn't write to "/home/em/public_html/railstest/public/../config/../log/fastcgi.crash.log":

    It should be /home/em/public_html/railstest/../log/

    Not sure how to help it... I set the RewriteBase in .htaccess if that has anything to do with it.

  9. #9
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    chmod your /log directory to 666 so the web server can write to it. While you're at it, chmod all the files in your /public directory to 755.

  10. #10
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, created the log it was looking for... only thing in it was a message about fastcgi starting... no errors.

    Deleted the error_log for my app to start fresh, reloaded the test url, and this is the entire error_log after:

    file /home/em/public_html/railstest/../config/../tmp/sessions//ruby_sess.0ba7799c3c6dd98b not readable
    /usr/local/lib/ruby/1.8/pstore.rb:95:in `initialize'
    /usr/local/lib/ruby/1.8/cgi/session/pstore.rb:70:in `initialize'
    /usr/local/lib/ruby/1.8/cgi/session.rb:273:in `initialize'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:111:in `session'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:141:in `stale_session_check!'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:107:in `session'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:887:in `assign_shortcuts_without_flash'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/flash.rb:141:in `assign_shortcuts'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:375:in `process_without_filters'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in `process'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in `process_request'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in `process!'
    /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
    /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in `process!'
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in `process!'
    /home/em/public_html/railstest/dispatch.fcgi:24

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Look in the /tmp/sessions folder of your Rails app. What are the permissions? Set them to something readable/writable.

  12. #12
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After doing chown -R nobody:nobody /path/to/rails/app/*

    ...it all seems to be working so far... weird.

  13. #13
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by DevilBear
    After doing chown -R nobody:nobody /path/to/rails/app/*

    ...it all seems to be working so far... weird.
    Rails is very peculiar about permissions

  14. #14
    SitePoint Addict DevilBear's Avatar
    Join Date
    Oct 2001
    Location
    Hades
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! I'm going to put this away for tonight. I'm sure I'll have more questions soon.

    Oh, I do notice that trying to access myurl.com/railsapp doesn't work ("Bad request") but myurl.com/railsapp/ with a trailing slash does.

    Also, what if I want userdomain.com/ to point to railsapp/public, not userdomain.com/subdirectory ?

  15. #15
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by DevilBear
    Thanks! I'm going to put this away for tonight. I'm sure I'll have more questions soon.

    Oh, I do notice that trying to access myurl.com/railsapp doesn't work ("Bad request") but myurl.com/railsapp/ with a trailing slash does.

    Also, what if I want userdomain.com/ to point to railsapp/public, not userdomain.com/subdirectory ?
    Set your domain/VirtualHost's DocumentRoot to the rails app's /public/ directory.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •