Redmine won't start, only shows index of

Added by Martin Backman about 8 years ago

Hi.
I have installed ruby and Redmine according to I don't know how many guides right now. And it went without errors so I don't really know where the error lies. Every time I search google for index of redmine, I get a lot of results with links to other servers with the same problem, but no solution though.

My problem is that when I navigate my browser to http://myserver/redmine I only get the "index of" page where apache lists all the files in the directory.

Modules passenger and fcgi is loaded in the apache server

RAILS_ENV=production script/about

Ruby version 1.8.7 (i486-linux)
RubyGems version 1.2.0
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/local/lib/redmine-0.8
Environment production
Database adapter mysql
Database schema version 101

apache2/sites-available/default

RailsBaseURI /usr/local/lib/redmine-0.8/public
Alias /redmine /usr/local/lib/redmine-0.8/public
<Directory /usr/local/lib/redmine-0.8/public>
Options -MultiViews Indexes ExecCGI FollowSymLinks
</Directory>

If you need more information I'll be happy to post them here. I can't figure out why it won't start

Replies (11)

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

Do you plan on using fcgi or passenger to server redmine? Both are options, but you can't use both to serve redmine (you can have both loaded in apache, but only one can serve redmine).

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

Please also note that your rails version is too old, you will need 2.3.5, and it seems your database migration hasn't gone through to the end.

RE: Redmine won't start, only shows index of - Added by Martin Backman about 8 years ago

I don't really know what to use, I started off by using passenger, but when that didn't work I found another article about how to make Redmine work with Apache, and therefore I installed fastcgi.

But if I do uninstall everything and install it again with a newer version of rails, what should I do if Apache won't load Redmine?
I guess it has something to do with Apache not knowing how to run a rails applications, like when using php and not loading the apache-php module.

Thank you for the quick answers.

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

You don't need to reinstall redmine. Try to:

  1. install ruby 2.3.5 (gem install rails -v=2.3.5)
  2. empty your redmine DB and re-run the DB migration (RAILS_ENV=production rake db:migrate)
  3. import the default redmine data (RAILS_ENV=production rake redmine:load_default_data)
  4. check if redmine is installed correctly with script/server -e production, this will start redmine on port 3000.

When you have confirmed this all works correctly, I suggest you use passenger, remove the file file/.htaccess (it is only needed for *cgi) and read and understand the apache configuration guide for passenger under http://modrails.com, and then you should get your apache/passenger configuration right.

RE: Redmine won't start, only shows index of - Added by Martin Backman about 8 years ago

Now Redmine works for me, with passenger.
There is only one problem though, there is no CSS enabled.
I only get a with page with the correct text and links, but it looks like hell.
Ever encountered this before, or know how to solve it?
I attached a screenshot from the page.

redmine.png (56.8 KB)

RE: Redmine won't start, only shows index of - Added by Martin Backman about 8 years ago

PS. I have followed the instructions on "HowTo Install Redmine in a sub-URI" but that didn't help... :(

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

Please post your apache configuration for that vhost and also what changes you have made to the redmine configuration.

RE: Redmine won't start, only shows index of - Added by Martin Backman about 8 years ago

Another thing that I have realized is that before installing redmine, to access phpmyadmin I only had to go to http://myserver/phpmyadmin, but after installing redmine I have to go to http://myserver/phpmyadmin/index.php otherwise I get "Redmine page not found"

Thanks for all the help you are giving me, I really appreciate it!

apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>

          DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

</IfModule>

apache2/sites-available/default

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
#    DocumentRoot /usr/local/lib/redmine/public/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

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

    <Directory /var/www/wiki>
               AllowOverride None
               Order Deny,Allow
               Deny from All
    </Directory>

    <Directory /var/www/confidential>
        AllowOverride None
        Order Deny,Allow
        Deny from All
    </Directory>

    DefaultInitEnv RAILS_ENV production
    #DefaultInitEnv GEM_PATH /usr/local/redmine-gems/
    PassengerAppRoot /var/www/redmine
    RailsBaseURI /redmine
    <Directory /var/www/redmine>
        AllowOverride All 
        Options -MultiViews
    </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

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

    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>

    ServerSignature Off
</VirtualHost>

redmine/config/environment.rb

# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# Load Engine plugin if available
begin
  require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
rescue LoadError
  # Not available
end

Rails::Initializer.run do |config|
  # Settings in config/environments/* take precedence those specified here

  # Skip frameworks you're not going to use
  # config.frameworks -= [ :action_web_service, :action_mailer ]

  # Add additional load paths for sweepers
  config.load_paths += %W( #{RAILS_ROOT}/app/sweepers )

  # Force all environments to use the same logger level 
  # (by default production uses :info, the others :debug)
  # config.log_level = :debug

  # Enable page/fragment caching by setting a file-based store
  # (remember to create the caching directory and make it readable to the application)
  # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache" 

  # Activate observers that should always be running
  # config.active_record.observers = :cacher, :garbage_collector
  config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer

  # Make Active Record use UTC-base instead of local time
  # config.active_record.default_timezone = :utc

  # Use Active Record's schema dumper instead of SQL when creating the test database
  # (enables use of different database adapters for development and test environments)
  # config.active_record.schema_format = :ruby

  # Deliveries are disabled by default. Do NOT modify this section.
  # Define your email configuration in email.yml instead.
  # It will automatically turn deliveries on
  config.action_mailer.perform_deliveries = false

  config.gem 'rubytree', :lib => 'tree'

  # Load any local configuration that is kept out of source control
  # (e.g. gems, patches).
  if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
    instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
  end
end

Redmine::Utils::relative_url_root = "/redmine" 
#ActionController::AbstractRequest.relative_url_root = "/redmine" 
#ActionController::Base.relative_url_root = "/redmine" 

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

One thing that must be very clear to you: a rails app doesn't work like a php app for example, where you just point apache to some php files and apache will happily execute the single php file if it finds one matching the request.

Rails apps have a defined structure in their app directory, and that directory shouldn't be in your www DocumentRoot. In a rails directory, there is a directory called public which contains all static assets, and that's the only one that should be accessible under the URI you are expecting your rails app to be. That's all pretty well explained in the passenger docs.

Make sure you have read the docs, then come back and understand the following steps, don't just execute them blindly. Think of them more as a confirmation of what you're doing than a step-by-step.

  • move your redmine to /opt/redmine (for example)
  • make a symlink from /opt/redmine/public to /var/www/redmine
  • Change your vhost conf to something like this:
        #DefaultInitEnv RAILS_ENV production
        #DefaultInitEnv GEM_PATH /usr/local/redmine-gems/
        #RailsBaseURI /redmine
        #<Directory /var/www/redmine>
        #    AllowOverride All 
        #    Options -MultiViews
        #</Directory>
  • Passenger should detect that yourserver.com/redmine is a rails app and start it accordingly, if not uncomment the RailsBaseURI part
  • you shouldn't need the Redmine::Utils::relative_url_root = "/redmine" in the config either

If it still doesn't work, try to see if you can access yourserver.com/redmine/stylesheets/application.css and if the html generated also looks for the css under yourserver.com/redmine (though the (relative) URI for the css will probably be /redmine/themes/<theme_name>/stylesheets/application.css).

RE: Redmine won't start, only shows index of - Added by Martin Backman about 8 years ago

Hi Felix,
I'm very sorry for taking up your time, I was in such a hurry to deploy my server I didn't want to spend time reading documentation, I wanted to do it as quickly as possible. I'm terribly sorry for wasting your time.

I did read the documentation, (great documentation by the way) and I didn't even need to look at your suggestions.

But if someone reads this and have the same problem I'll post how the problem was solved.

I moved the redmine folder to /srv/rails/redmine (could be any folder) and made a soft link.

ln -s /srv/rails/redmine/public /srv/www/redmine

Edited the apache configuration (inside virtual host block)

DefaultInitEnv RAILS_ENV production
RailsBaseURI /redmine
<Directory /srv/www/redmine>
    Options -MultiViews
</Directory>

And then, restart Apache

And again, Felix I'm sorry, and I thank you for taking the time and replying to my posts. I really appreciate it!

Martin.

RE: Redmine won't start, only shows index of - Added by Felix Schäfer about 8 years ago

Martin Backman wrote:

And again, Felix I'm sorry, and I thank you for taking the time and replying to my posts. I really appreciate it!

I'm sorry if I seemed a little insistent, but in the end this will save your time because you now should know how to do it, so next time you won't have to wait for someone to help you :-) Glad you got it working!

(1-11/11)