Redmine + Apache Passenger only shows directory index

Added by nico ps over 3 years ago

Hello,

i cant solve the problem that redmine+passanger only shows the folder index of redmine/public.
Maybe someone can give me a clue how to solve it.
We are using SuseLinux (SLES11) and all packages like apache2, ruby, rubygems... was installed by the local reposorty of SLES11

webrick works

ruby script/rails server webrick -e production runs well and i can access Redmine via the browser.

redmine is under /opt/redmine
in the documentroot of the apache (/srv/www) is a link to the redmine folder.

"apache2ctl -S" Shows:
VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:80 _ Hostname.mycompany.com_ (/etc/apache2/conf.d/redmine.conf:1)
Syntax OK

RAILS_ENV=production script/about
sh: svn: command not found
sh: darcs: command not found
sh: hg: command not found
sh: bzr: command not found
sh: git: command not found
Environment:
  Redmine version                2.4.3.stable
  Ruby version                   1.8.7-p357 (2011-12-28) [x86_64-linux]
  Rails version                  3.2.16
  Environment                    production
  Database adapter               MySQL
SCM:
  Cvs                            1.12.12
  Filesystem
Redmine plugins:
  no plugin installed

Passenger was installed by "gem install passenger" and "passenger-install-apache2-module".
After this the apache httpd.conf was modified by adding following lines:

#Insert from the installation from passenger
LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/passenger-4.0.48/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-4.0.48
     PassengerDefaultRuby /usr/bin/ruby
   </IfModule>

The VirtualHost file looks like (/etc/apache2/conf.d/redmine.conf)

<VirtualHost *:80>
      ServerName _Hostname.mycompany.com_
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /opt/redmine/public
      <Directory /opt/redmine/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews FollowSymLinks
         # Uncomment this if you're on Apache >= 2.4:
         Require all granted

      </Directory>
    RailsBaseURI /redmine
    # These have been added: (Passenger guide)
    Alias /redmine /opt/redmine/public
    <Directory /opt/redmine/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        Require all granted
    </Directory>
</VirtualHost>

At least my /opt/redmine/config/environment.rb looks like

# Load the rails application
require File.expand_path('../application', __FILE__)

# Make sure there's no plugin in vendor/plugin before starting
vendor_plugins_dir = File.join(Rails.root, "vendor", "plugins")
if Dir.glob(File.join(vendor_plugins_dir, "*")).any?
  $stderr.puts "Plugins in vendor/plugins (#{vendor_plugins_dir}) are no longer allowed. " +
    "Please, put your Redmine plugins in the `plugins` directory at the root of your " +
    "Redmine directory (#{File.join(Rails.root, "plugins")})" 
  exit 1
end
#ENV['RAILS_ENV'] ||= 'production'
#Redmine::Utils::relative_url_root = "/redmine" 

# Initialize the rails application
RedmineApp::Application.initialize!

I hope to get a clue. Thanks

redmine index.png (23.9 KB)

Replies (7)

RE: Redmine + Apache Passenger only shows directory index - Added by Alex Wilhelmy over 3 years ago

Be sure passenger-module is running. Here how to test and a sample output:

root@xxx:/usr/share/redmine2/log# passenger-status
Version : 4.0.20
Date    : Fri Jul 25 10:51:31 +0200 2014
Instance: 23468
----------- General information -----------
Max pool size : 6
Processes     : 1
Requests in top-level queue : 0

----------- Application groups -----------
/usr/share/redmine2#default:
  App root: /usr/share/redmine2
  Requests in queue: 0
  * PID: 2688    Sessions: 0       Processed: 468     Uptime: 19h 44m 6s
    CPU: 0%      Memory  : 230M    Last used: 1m 54s a

root@xxx:/usr/share/redmine2/log#

If not, track down paths in passenger.conf: do they exist?
Have also a look at passenger.load:

root@xxx:/etc/apache2/mods-enabled# cat passenger.conf
<IfModule mod_passenger.c>
  PassengerDefaultUser www-data
  PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.20
  PassengerDefaultRuby /usr/bin/ruby1.8
</IfModule>
root@xxx:/etc/apache2/mods-enabled#
root@xxx:/etc/apache2/mods-enabled# cat passenger.load
# vor 20131017:
# LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.20/buildout/apache2/mod_passenger.so

# EOF

root@xxx:/etc/apache2/mods-enabled#

Had the same problem and hope this helps

Alex

RE: Redmine + Apache Passenger only shows directory index - Added by nico ps over 3 years ago

Hi Alex Thanks for your hint. I checked passenger-status and noticed that there isnt any Process but i dont know how to start the process. Do you know how to get the process start? so there is a 1 like at your example? Here is the output:

Version : 4.0.48
Date    : Fri Jul 25 12:39:59 +0200 2014
Instance: 27487
----------- General information -----------
Max pool size : 6
Processes     : 0
Requests in top-level queue : 0

----------- Application groups -----------

I checked all the paths and files you posted. Every path seems to be right.

After starting "service apache2 start" the error.log file says "All Phusion Passenger agents started!":

[ 2014-07-25 12:31:54.1359 27488/7fa795407720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'www', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'wwwrun', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/lib64/ruby/gems/1.8/gems/passenger-4.0.48', 'passenger_version' => '4.0.48', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.48', 'web_server_pid' => '27487', 'web_server_type' => 'apache', 'web_server_worker_gid' => '8', 'web_server_worker_uid' => '30' }
[ 2014-07-25 12:31:54.1401 27491/7f0b346ab720 agents/HelperAgent/Main.cpp:649 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.27487/generation-0/request
[ 2014-07-25 12:31:54.1452 27497/7f60b9c5c740 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.27487/generation-0/logging
[ 2014-07-25 12:31:54.1454 27488/7fa795407720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Fri Jul 25 12:31:54 2014] [notice] Apache/2.2.12 (Linux/SUSE) Phusion_Passenger/4.0.48 configured -- resuming normal operations

Seems to me okay isnt it?

And i tested passenger-memory-stats which displays my apache and passanger processes.

Hostname:/opt/redmine # passenger-memory-stats
Version: 4.0.48
Date   : Fri Jul 25 13:05:13 +0200 2014

--------- Apache processes ----------
PID    PPID   VMSize   Private  Name
-------------------------------------
27953  1      79.7 MB  0.2 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
27972  27953  79.7 MB  0.1 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
27973  27953  79.7 MB  0.1 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
27974  27953  79.7 MB  0.1 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
27975  27953  79.7 MB  0.1 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
27976  27953  79.7 MB  0.1 MB   /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
### Processes: 6
### Total private dirty RSS: 0.73 MB

-------- Nginx processes --------

### Processes: 0
### Total private dirty RSS: 0.00 MB

----- Passenger processes -----
PID    VMSize    Private  Name
-------------------------------
27954  17.7 MB   0.2 MB   PassengerWatchdog
27957  107.5 MB  0.3 MB   PassengerHelperAgent
27963  54.8 MB   0.7 MB   PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 1.29 MB

Nico

RE: Redmine + Apache Passenger only shows directory index - Added by Alex Wilhelmy over 3 years ago

Nico,

maybe this helps: http://www.redmine.org/boards/2/topics/15491
I think it should solve your problem.

Cheers

Alex

RE: Redmine + Apache Passenger only shows directory index - Added by Jan Niggemann (redmine.org team member) over 3 years ago

Nico,

you seem to be lacking the "Passenger spawn server" as well as the actual application in the output of passenger-memory-stats but then again, I'm still on the v3 branch, perhaps v4 does things differently.

----- Passenger processes -----
PID    VMSize    Private  Name
-------------------------------
30401  4.3 MB    0.2 MB   PassengerWatchdog
30404  13.4 MB   0.5 MB   PassengerHelperAgent
30406  11.1 MB   5.0 MB   Passenger spawn server
30409  11.1 MB   0.6 MB   PassengerLoggingAgent
30835  102.0 MB  45.5 MB  Rails: /opt/redmine
.
.
.

Your passenger does not seem to start.
How did you install and enable it? As a package (yum, apt-get, ...) or as a gem, or from source?

RE: Redmine + Apache Passenger only shows directory index - Added by nico ps over 3 years ago

Thanks for the answers up to now.

I will try the above guide from you alex.

Passenger was installed by the gem:

gem install passenger
passenger-install-apache2-module

Then i followed the installation guide.

Passenger isnt running? But the log of /var/log/apache2/error_log says

[notice] Apache/2.2.12 (Linux/SUSE) Phusion_Passenger/4.0.48 configured -- resuming normal operations

Is there a command to start the Passenger-Spawn-server?

RE: Redmine + Apache Passenger only shows directory index - Added by nico ps over 3 years ago

Now Redmine is running on Apache2+Passenger!

First of all I patched Redmine to the newest version(2.5.2)

Then i found the problem in my VirtualHost configuration.

The apache configuration has the following entery

Listen *:3000

So i changed the VirtualHost to

<VirtualHost *:3000>
    ....
</VirtualHost>

passenger-status:

Version : 4.0.48
Date    : Fri Aug 01 08:17:45 +0200 2014
Instance: 11741
----------- General information -----------
Max pool size : 6
Processes     : 1
Requests in top-level queue : 0

----------- Application groups -----------
/opt/redmine#default:
  App root: /opt/redmine
  Requests in queue: 0
  * PID: 11793   Sessions: 0       Processed: 1       Uptime: 1m 53s
    CPU: 0%      Memory  : 85M     Last used: 1m 53s ago

I appreciate for all the help!

RE: Redmine + Apache Passenger only shows directory index - Added by Alex Wilhelmy over 3 years ago

Nico,

great! and thanks for sharing your solution.

Alex

(1-7/7)