Apache2 + passenger configuration

Added by Leonardo Giordani over 8 years ago

Hi all,

I'm trying to run Redmine under my already working Apache2, where I host other services on a local network (Apache2 on Kubuntu 8.04). I already succesfully run WEBrick and redmine works perfectly, but I would prefer to run only the Apache webserver.

After running passenger-install-apache2-module I configured Apache te following way

/etc/apache2/sites-available/default:

NameVirtualHost *

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.1.3
PassengerRuby /usr/bin/ruby1.8
<VirtualHost *>
 ServerName myserver/redmine
 DocumentRoot /var/www/redmine/public
 RailsEnv production
 ErrorLog /var/log/apache2/redmine.error.log
</VirtualHost>

<VirtualHost *>
 ServerAdmin webmaster@localhost

 DocumentRoot /var/www/
 <Directory />
[...]

where "myserver" is the name under which the server is reachable through DNS.
Apache reloads or resets without errors, but when I try to connect to http://myserver/redmine I get a 404 written in the redmine font

Page not found

The page you were trying to access doesn't exist or has been removed.

Back

I'm lost. Please take into account that I'm a total newbie of Apache and RoR.

Thank you in advance

Leonardo Giordani

Replies (12)

RE: Apache2 + passenger configuration - Added by Jean-Baptiste Barth over 8 years ago

This: ServerName myserver/redmine seems incorrect to me.
Have you looked this howto ?

RE: Apache2 + passenger configuration - Added by Leonardo Giordani over 8 years ago

Thank you very much. I solved following your link till

"http://www.modrails.com/documentation/Users guide.html#deploying_rails_to_sub_uri"

My steps are the following (if someone get lost at the same point)

  • Redmine is installed under /opt/redmine
  • ln -s /opt/redmine/public/ /var/www/redmine
  • Add the following to the default VirtualHost (sorry, the most basic configuration)
 RailsEnv production
 RailsBaseURI /redmine
  • Access your Redmine through hxxp://servername/redmine

Leonardo

RE: Apache2 + passenger configuration - Added by Adinda Praditya over 8 years ago

Hi,

I'm deploying multiple rails to sub uri. The first app is OK and i would like to add redmine. So i created the sym link, and add another RailsBaseURI under the previous rails app. I still get this page. Did i miss something?

FYI, previously, with the same setting, the page i got was the passenger error page. I'm pretty sure that i have fixed this error (i can run from the root app and no error on the apache's error log).

Thanks!

RE: Apache2 + passenger configuration - Added by Adinda Praditya over 8 years ago

I solved the last 404 issue by uncommenting this line in environment.rb:

config.action_controller.relative_url_root

Set the value exactly the same with the RailsBaseURI in apache configuration. I think this should be checked when such error occurs.

Thanks!

RE: Apache2 + passenger configuration - Added by Vivien Didelot about 8 years ago

Hi all !

I want to do the same thing as you, that is to say running Redmine through Apache using Passenger in a sub-uri. My server is on Ubuntu 9.04 server edition. But I still got problems.
Here what I done :
  • get Redmine working (on my_server:3000)
  • sudo aptitude install libapache2-mod-passenger
  • sudo a2enmod passenger
  • sudo ln -s /opt/redmine/public/ /var/www/redmine
  • edit /etc/apache2/sites-available/default to add at the bottom of the file (before </VirtualHost>) :
    RailsEnv production
    RailsBaseURI /redmine
    
  • sudo /etc/init.d/apache2 restart

But that does not work. I'm still getting a Passenger error page "Ruby on Rails application could not be started" with :

Error message:
    No such file or directory - /nonexistent
Exception class:
    Errno::ENOENT
Application root:
    /opt/redmine

Please tell me where is my problem. I need something more explicit.
Thanks a lot for your time !

v0n.

RE: Apache2 + passenger configuration - Added by m p almost 8 years ago

Leonardo Giordani wrote:

Thank you very much. I solved following your link till

"http://www.modrails.com/documentation/Users guide.html#deploying_rails_to_sub_uri"

My steps are the following (if someone get lost at the same point)

  • Redmine is installed under /opt/redmine
  • ln -s /opt/redmine/public/ /var/www/redmine
  • Add the following to the default VirtualHost (sorry, the most basic configuration)

[...]

  • Access your Redmine through hxxp://servername/redmine

Leonardo

follwed this and it works just fine, but i get the error below in apache error log.
this happens everytime i click something in redmine-0.8.7

[Wed Jan 06 15:04:50 2010] [error] [client xxx.xxx.xx.xx] File does not exist: /var/www/plugin_assets, referer: http://xxx.xxx.xx.xx/redmine/projects/show/aa

RE: Apache2 + passenger configuration - Added by Vivien Didelot almost 8 years ago

I solved my problem and I wrote the how-to (in French) here: http://doc.ubuntu-fr.org/redmine#servir_redmine_via_apache (see "Méthode 1 : Dans un dossier").
Maybe it could help you.
Good luck,

v0n.

RE: Apache2 + passenger configuration - Added by m p almost 8 years ago

thanks v0n,

barely managed to follow that,
but i stil get the same error, although everything seems to be working fine.

RE: Apache2 + passenger configuration - Added by m p almost 8 years ago

Bump,

Hey v0n (or anyone) don't you have the same errors in your /var/log/apaches2/error.log

although everything seems to be working fine i still get something like below:

[Thu Jan 21 14:59:39 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/favicon.ico

[Thu Jan 21 14:59:40 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/favicon.ico

[Thu Jan 21 15:00:34 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/plugin_assets, referer: http://xxx.xxx.xxx.xx/redmine/

[Thu Jan 21 15:00:35 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/plugin_assets, referer: http://xxx.xxx.xxx.xx/redmine/

[Thu Jan 21 15:01:42 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/plugin_assets, referer: http://xxx.xxx.xxx.xx/redmine/projects

[Thu Jan 21 15:01:43 2010] [error] [client xxx.xxx.xxx.xx] File does not exist: /var/www/plugin_assets, referer: http://xxx.xxx.xxx.xx/redmine/projects

and so on for every link that i click in redmine
Stumped

RE: Apache2 + passenger configuration - Added by Kamil . over 7 years ago

I had the similar problem, but it was connected with version of Rake and Rails!
If you are using debian, then

apt-get install ruby1.8

does not do the trick, because required versions are not there! You have to:
apt-get install ruby1.8-dev

and then
gem install rake -v=0.8.3

and
gem install rails -v=2.3.5

Regards

RE: Apache2 + passenger configuration - Added by Alex Dergachev about 5 years ago

For me it was a simple permissions error. Uncovered by doing the following:

tail -f /var/www/redmine/log/production.log

Processing AttachmentsController#show (for 192.168.1.33 at 2012-11-27 11:27:58) [GET]
Parameters: {"action"=>"show", "id"=>"3310", "filename"=>"FILENAME.pdf", "controller"=>"attachments"}
Rendering template within layouts/base
Rendering common/error (404)
Filter chain halted as [:file_readable] rendered_or_redirected.
Completed in 36ms (View: 32, DB: 1) | 404 Not Found [https://rm.ewdev.ca/attachments/3130/FILENAME.pdf]

(1-12/12)