"500 Internal Server Error" in Apache. Runs fine in WEBrick.

Added by Brian Daley over 8 years ago

I'm using 0.8-stable from svn. I've configured everything as outlined in the installation guide. Everything runs beautifully when started in WEBrick. Running in Apache, however, yields a 500 error that appears to be echo'd by Redmine, not Apache's default.

I'm using Ruby Enterprise Edition on Ubuntu 8.04.

Here's my setup:

Ruby version              1.8.7 (i686-linux)
RubyGems version          1.3.5
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Application root          /usr/share/redmine/redmine-0.8
Environment               production
Database adapter          mysql
Database schema version   101

Here is the production.log output:

/!\ FAILSAFE /!\  Tue Jan 12 14:22:02 -0500 2010
  Status: 500 Internal Server Error
  No route matches "/index.html" with {:method=>:get}
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/routing/recognition_optimisation.rb:67:in `recognize_path'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/routing/route_set.rb:385:in `recognize'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:148:in `handle_request'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:107:in `dispatch'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:104:in `dispatch'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/dispatcher.rb:35:in `dispatch'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/request_handler.rb:50:in `process_request'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:378:in `start_request_handler'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:181:in `spawn_application!'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb:183:in `safe_fork'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:153:in `spawn_application!'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:272:in `spawn_rails_application'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/bin/passenger-spawn-server:61

Replies (5)

RE: "500 Internal Server Error" in Apache. Runs fine in WEBrick. - Added by John Fisher over 8 years ago

Brian, you'll need to post your /etc/apache2/sites-enabled/default or other Apache config content.

There a lot of posts here with suggestions about using Apache, and I wrote one myself, which, alas, I can't find.

a couple of starting points:
1) Rails likes to run in docroot, so if your overall docroot is /var/www then redmine would be placed in /var/www/redmine ( "redmine" can be a symlink) and in your "default" apache file, in the Virtual Host section for redmine, use "DocumentRoot /var/www/redmine/public/"
(this comment assumes the use of Passenger and not FCGI, and Virtual Hosts set up in default.)

2) For most changes in the Rails/Ruby code you have to restart Apache /etc/init.d/apache2 restart

3) Your error logs are in ~redmine/log but you must make the log amd tmp directories world-writeable ( chmod 777 log) also tail the apache error log.

that should get you started...

John

RE: "500 Internal Server Error" in Apache. Runs fine in WEBrick. - Added by Brian Daley over 8 years ago

John -

Thanks for responding. Here is my vhost config file:

<VirtualHost *:80>
  ServerName something
  DocumentRoot /usr/share/redmine/redmine-0.8/public
     <Directory /usr/share/redmine/redmine-0.8/public>
        AllowOverride all
        Options -MultiViews
     </Directory>
</VirtualHost>

See my responses below:

John Fisher wrote:

Brian, you'll need to post your /etc/apache2/sites-enabled/default or other Apache config content.

There a lot of posts here with suggestions about using Apache, and I wrote one myself, which, alas, I can't find.

a couple of starting points:
1) Rails likes to run in docroot, so if your overall docroot is /var/www then redmine would be placed in /var/www/redmine ( "redmine" can be a symlink) and in your "default" apache file, in the Virtual Host section for redmine, use "DocumentRoot /var/www/redmine/public/"
(this comment assumes the use of Passenger and not FCGI, and Virtual Hosts set up in default.)

Tried this before. No dice. I might fool with it a little more though. At the moment, it's my only avenue.

2) For most changes in the Rails/Ruby code you have to restart Apache /etc/init.d/apache2 restart

I've been restarting Apache frequently during my attempts to resolve the problem. In fact, Apache restarts are the only items appearing in my Apache error log.

3) Your error logs are in ~redmine/log but you must make the log amd tmp directories world-writeable ( chmod 777 log) also tail the apache error log.

tmp and log are writeable. Apache error log, see above (#2)

that should get you started...

John

RE: "500 Internal Server Error" in Apache. Runs fine in WEBrick. - Added by John Fisher over 8 years ago

OK let me be clear: I am a fellow-sufferer not an expert, but until somebody comes along I'll suggest a few things....

To get your apache errorlogs to have more stuff ( I didn't say "better" stuff necessarily)
add "LogLevel debug" to your VHost section.
Are you getting info in the Redmine logs? I kind of expect not, since Apache isn't even connecting you....

"no dice" - I don't understand your response. Are you limited in how you set up your server? I was completely unable to get rails|redmine to run anywhere but in docroot. Others seem to have done so, however.

Heres my entire default file:

<VirtualHost *:80>
ServerAdmin
ServerName dizzy.example.com
DocumentRoot /var/www/

<Directory />
Options FollowSymLinks
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

  1. Possible values include: debug, info, notice, warn, error, crit,
  2. alert, emerg.
    LogLevel info

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so

<VirtualHost *:80>
ServerAdmin
ServerName redmine.here.example.com
DocumentRoot /var/www/redmine/public/
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8
PassengerRuby /usr/bin/ruby1.8
RailsEnv development

<Directory "/var/www/redmine/public/">
Options Indexes +ExecCGI FollowSymLinks
#AddHandler fcgid-script .fcgi
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel debug

</VirtualHost>

RE: "500 Internal Server Error" in Apache. Runs fine in WEBrick. - Added by John Fisher over 8 years ago

sorry, I see your production.log, forget that question...
Whoops, try getting rid of redmine/public/.htaccess, that might be why Apache is adding "html" extension....

JF

RE: "500 Internal Server Error" in Apache. Runs fine in WEBrick. - Added by Brian Daley over 8 years ago

Wow, that's all it was... ugh. I renamed .htaccess and everything loaded properly. Thanks for taking the time to help me out!

-Brian

(1-5/5)