Forum: Ruby on Rails Help with Apache config

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John W. (Guest)
on 2006-05-17 17:09
I have been attempting for days to configure Apache for Rails. I have
read forums, followed How-To's all in vain. I am hoping someone can help
me out.  I am getting the Rails Welcome screen, but when trying to go to
any other url, I get the 500.html message.  Take a look for yourself at
http://66.139.78.237 and click on "about your application's
environment".

Below is my VirtualHost directive in httpd.conf.  I can provide more
info if necessary.

<VirtualHost *:80>

  SetEnv RAILS_ENV production
  DocumentRoot /usr/local/apache/htdocs/test/public/
  ErrorLog /usr/local/apache/logs/apache.log
  ServerName 66.139.78.237
  LogLevel emerg

  <Directory /usr/local/apache/htdocs/test/public/>
      Options ExecCGI FollowSymLinks
      AddHandler cgi-script .cgi
      AllowOverride all
      Order allow,deny
      Allow from all
   </Directory>

</VirtualHost>
Dick D. (Guest)
on 2006-05-17 17:21
(Received via mailing list)
On 17/05/06, Zac W. <removed_email_address@domain.invalid> wrote:
> I have been attempting for days to configure Apache for Rails. I have
> read forums, followed How-To's all in vain. I am hoping someone can help
> me out.  I am getting the Rails Welcome screen, but when trying to go to
> any other url, I get the 500.html message.  Take a look for yourself at
> http://66.139.78.237 and click on "about your application's
> environment".

Now you need to look in the rails error log.
It'll be in

RAILS_ROOT/logs/production.log

If that's blank, apache probably has trouble running cgis, so look in

 /usr/local/apache/logs/apache.log
Nuno (Guest)
on 2006-05-17 17:22
How is your configuration of mod_fcgi ??

You should have something like
<IfModule mod_fastcgi.c>
    FastCgiIpcDir /tmp/fcgi_ipc
    FastCgiServer /usr/local/www/my_ror_app/public/dispatch.fcgi
-initial-env RAILS_ENV=production
 -idle-timeout 30
</IfModule>

Do you ?
John W. (Guest)
on 2006-05-17 17:25
Dick D. wrote:
>
> Now you need to look in the rails error log.
> It'll be in
>
> RAILS_ROOT/logs/production.log
>
> If that's blank, apache probably has trouble running cgis, so look in
>
>  /usr/local/apache/logs/apache.log

Here are the last 20 lines of my production.log

/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:375:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/apache/htdocs/test/public/dispatch.cgi:10
Permission denied -
/usr/local/apache/htdocs/test/public/../config/../tmp/sessions//ruby_sess.d71c424b49aac4ee
/usr/lib/ruby/1.8/pstore.rb:289:in `initialize'
/usr/lib/ruby/1.8/pstore.rb:289:in `transaction'
/usr/lib/ruby/1.8/cgi/session/pstore.rb:71:in `initialize'
/usr/lib/ruby/1.8/cgi/session.rb:273:in `initialize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:111:in
`session'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:141:in
`stale_session_check!'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/cgi_process.rb:107:in
`session'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:887:in
`assign_shortcuts_without_flash'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/flash.rb:141:in
`assign_shortcuts'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:375:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/apache/htdocs/test/public/dispatch.cgi:10
John W. (Guest)
on 2006-05-17 17:27
Nuno wrote:
> How is your configuration of mod_fcgi ??
>
> You should have something like
> <IfModule mod_fastcgi.c>
>     FastCgiIpcDir /tmp/fcgi_ipc
>     FastCgiServer /usr/local/www/my_ror_app/public/dispatch.fcgi
> -initial-env RAILS_ENV=production
>  -idle-timeout 30
> </IfModule>
>
> Do you ?

Yes, Here is what I have...  It looks a little different than your
example... Maybe I should change it?

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /tmp/fcgi_ipc
  FastCgiServer fastcgi-script .fcgi
    -initial-env RAILS_ENV=development \
    -idle-timeout 60
</IfModule>
Dick D. (Guest)
on 2006-05-17 17:43
(Received via mailing list)
On 17/05/06, John W. <removed_email_address@domain.invalid> wrote:

> /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
> `dispatch'
> /usr/local/apache/htdocs/test/public/dispatch.cgi:10
> Permission denied -
> 
/usr/local/apache/htdocs/test/public/../config/../tmp/sessions//ruby_sess.d71c424b49aac4ee

Have you been using webrick? Clear out your sesiions directory (shown
above)
John W. (Guest)
on 2006-05-17 17:49
Dick D. wrote:

> Have you been using webrick? Clear out your sesiions directory (shown
> above)

I have been using it, however the sessions directory is clear.  Is the
"permission denied" referring to the dispatch.fcgi script?  Looks like
all should have execute permission there:

-rwxr-xr-x  1 zwilliam apache  473 May 17 07:29 dispatch.cgi
-rwxr-xr-x  1 zwilliam apache  855 May 17 07:29 dispatch.fcgi
-rwxr-xr-x  1 zwilliam apache  473 May 17 07:29 dispatch.rb
Dick D. (Guest)
on 2006-05-17 17:56
(Received via mailing list)
On 17/05/06, John W. <removed_email_address@domain.invalid> wrote:
> >
> > Do you ?
>
> Yes, Here is what I have...  It looks a little different than your
> example... Maybe I should change it?

No, it's not that. You're not using fastcgi yet.
Dick D. (Guest)
on 2006-05-17 17:59
(Received via mailing list)
On 17/05/06, John W. <removed_email_address@domain.invalid> wrote:
> Dick D. wrote:
>
> > Have you been using webrick? Clear out your sesiions directory (shown
> > above)
>
> I have been using it, however the sessions directory is clear.

That's not what the error said. Are you sure you're checking the right
directory? Should be:


   /usr/local/apache/htdocs/test/tmp/sessions/
Jón B. (Guest)
on 2006-05-17 18:03
(Received via mailing list)
I have often wondered about this IfModule mod_fastcgi.c setting. Don't
seem to need it. At least everything runs fine without it. What do I
gain by putting this in?

On 5/17/06, Nuno <removed_email_address@domain.invalid> wrote:
> Do you ?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Nuno (Guest)
on 2006-05-17 18:08
The IfModule is just a check to be sure that mod_fastcgi is available on
the system...
Jón B. (Guest)
on 2006-05-17 18:28
(Received via mailing list)
On 5/17/06, Nuno <removed_email_address@domain.invalid> wrote:
> The IfModule is just a check to be sure that mod_fastcgi is available on
> the system...
>

Sorry.. I was unclear... I meant the whole part. including this part of
it.

  FastCgiIpcDir /tmp/fcgi_ipc
   FastCgiServer /usr/local/www/my_ror_app/public/dispatch.fcgi
-initial-env RAILS_ENV=production
 -idle-timeout 30

Is it just to cofigure the enviroment? What if I have multiple rails
apps. Do I simply have multiple FastCgiServer lines?

> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Erlend S. (Guest)
on 2006-05-19 17:09
(Received via mailing list)
On Wed, 2006-05-17 at 15:49 +0200, John W. wrote:
> I have been using it, however the sessions directory is clear.  Is the
> "permission denied" referring to the dispatch.fcgi script?  Looks like
> all should have execute permission there:
>
> -rwxr-xr-x  1 zwilliam apache  473 May 17 07:29 dispatch.cgi
> -rwxr-xr-x  1 zwilliam apache  855 May 17 07:29 dispatch.fcgi
> -rwxr-xr-x  1 zwilliam apache  473 May 17 07:29 dispatch.rb

WebBrick runs as your user, but apache runs as a different user. Make
sure Apache has write access to the sessions/cache/sockets in
yourapp/tmp.

--
Erlend S. <removed_email_address@domain.invalid>
ClockingIT - http://www.clockingit.com
This topic is locked and can not be replied to.