Project

General

Profile

Redmine + Apache + Passenger

Added by Graham Roberts over 13 years ago

Hi,

Despite having absolutely zero Ruby experience I'm trying to get Redmine installed as it looks superb.

The first part went really well and using Webbrick I can use Redmine.

But I want to use Apache for efficieny. I start off with mod_cgi, but I hit an error with that, the error_log was showing:
Premature end of script headers: dispatch.cgi

If I executed the cgi script I got:
./../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
from /opt/redmine-0.9.5/public/dispatch.rb:12
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/redmine-0.9.5/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from ./dispatch.cgi:8

After looking around the general solution seemed to be to use passenger/modrails, so I got that installed, added the vhost, pointing to public etc. But when I request the URL for the redmine install I get the Apache 2 Test Page, and looking in the logs it says:
Directory index forbidden by Options directive:

I don;t know much about rails, but I'm guessing my request should get routed somehow and avoid this standard behaviour.

I also tried running dispatch.rb from command prompt to see what happens, and I got this:
./../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
/opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
from /opt/redmine-0.9.5/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
from ./dispatch.rb:12

Heres my environment data:
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.6
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /opt/redmine-0.9.5
Environment production
Database adapter mysql
Database schema version 20100221100219

Any ideas how I can get this up and running?

Many thanks

Graham


Replies (8)

RE: Redmine + Apache + Passenger - Added by Felix Schäfer over 13 years ago

Dispatch.rb is only used with *cgi, not with passenger. IIRC you just need to remove the public/.htacess in the redmine directory to stop apache from trying to use *cgi and use passenger instead (provided passenger is configured right).

RE: Redmine + Apache + Passenger - Added by Graham Roberts over 13 years ago

Thanks for stopping by to help.

I had been wondering if that was the case and tried a couple of things which I should have added above. So currently:

in ./public I have
dispatch.cgi.example
dispatch.fcgi.example
dispatch.rb.example
x.htaccess

So it shouldn;t be using any of those files right. But if If ruquest http://myredmineproject/ I am still seeing the standard "Apache 2 Test Page", its like modrails isn;t being called into action.

The access_log shows this:
"GET / HTTP/1.1" 403 5043

This would be because there is no index.html|index.php file in the public folder, ut my assumption is that modrails should be jumping in before apache tries to look for an index page.

Any ideas?

Many thanks

Graham

RE: Redmine + Apache + Passenger - Added by Felix Schäfer over 13 years ago

Please post your apache configuration for that vhost, and make sure apache has loaded the passenger module (with apache2 -M IIRC).

RE: Redmine + Apache + Passenger - Added by Graham Roberts over 13 years ago

vhost is as follows:
<VirtualHost *:80>
ServerName xxxxx.co.uk
DocumentRoot /opt/redmine-0.9.5/public
ErrorLog logs/redmine_error_log
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>

I also have this:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.0
PassengerRuby /usr/local/bin/ruby

This was latest version of passenger but I decided to try an older version to see if it helped - same result though.

Module output looks ok:
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_alias_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authn_default_module (shared)
authz_host_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_groupfile_module (shared)
authz_dbm_module (shared)
authz_default_module (shared)
ldap_module (shared)
authnz_ldap_module (shared)
include_module (shared)
log_config_module (shared)
logio_module (shared)
env_module (shared)
ext_filter_module (shared)
mime_magic_module (shared)
expires_module (shared)
deflate_module (shared)
headers_module (shared)
usertrack_module (shared)
setenvif_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
info_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_connect_module (shared)
cache_module (shared)
suexec_module (shared)
disk_cache_module (shared)
file_cache_module (shared)
cgi_module (shared)
version_module (shared)
perl_module (shared)
php5_module (shared)
proxy_ajp_module (shared)
python_module (shared)
ssl_module (shared)
passenger_module (shared)
Syntax OK

Many thanks

Graham

RE: Redmine + Apache + Passenger - Added by Felix Schäfer over 13 years ago

Try this:

<VirtualHost *:80>
    ServerName xxxxx.co.uk
    DocumentRoot /opt/redmine-0.9.5/public
    ErrorLog logs/redmine_error_log
    <Directory /opt/redmine-0.9.5/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

Works for me at least. Passenger should auto-detect the rails application, if not make sure the user apache is running as has access to that path. If it still doesn't work, add "RailsBaseURI /" in the vhost section to force passenger to run.

RE: Redmine + Apache + Passenger - Added by Graham Roberts over 13 years ago

Hi Again,

Thanks for sticking with this. I didn;t spot it at first but after your post I checked my vhost again and spotted that I had pasted a wrong path into the directory tag, which probably wasn't helping, but I don;t think that is the only problem.

I had been checking the error_log for this vhost, but I should have also checked the main apache error log - I think I have a problem with SELinux and permissions:
[Fri Jul 09 17:06:43 2010] [error] *** Passenger could not be initialized because of this error: Cannot create FIFO file /tmp/passenger.5488/.guard: Permission denied (13)

I'm just checking this out now, but if you know the fix please let me know.

Many thanks

Graham

RE: Redmine + Apache + Passenger - Added by Graham Roberts over 13 years ago

Ok, so this is definitely an SELinux issue, so I was just looking in the wrong place.

Thanks very much Felix - it was your comments that prompted me to look in the right place.

Many thanks

Graham

RE: Redmine + Apache + Passenger - Added by s s over 13 years ago

I had the same issue as Graham Roberts described in his first post.
In my case it was not SELinux related, and deleting/renaming .htaccess actually fixes this.

    (1-8/8)