7

I am having a problem with Passenger not being able to start due to an apparently common issue in which Passenger claims: No such file or directory - config/environment.rb.

I have searched the web high and low and this appears to be a permissions related issue. It is my understanding that Passenger runs as the owner of config.ru and config/environment.rb file. In my case this owner is "admin". I am running the app root in the home directory of the admin user. So I believe I have the correct permissions set using: sudo chown -R admin:admin /home/admin/www and sudo chmod -R 755 /home/admin/www

where the app root is located at: /home/admin/www/app

Here is my virtual server config file:

 <VirtualHost *:80>
    ServerName track.example.com
    DocumentRoot /home/admin/www/app/current/public
    <Directory /home/admin/www/app/current/public>
    Options FollowSymLinks
    AllowOverride none
    Order allow,deny
    Allow from all
    </Directory>
    PassengerResolveSymlinksInDocumentRoot on
    RailsBaseURI /
    PassengerAppRoot /home/admin/www/app
    RailsEnv production   
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I am running Ubuntu 12.0.4, Rails 3.2.8, Ruby 1.9.3, Passenger 3.0.18, Apache 2

Thanks for your help.

acoustic_north
  • 171
  • 1
  • 2

3 Answers3

1

Whenever I have issues I don't understand I usually reboot a fresh drive on my linode and quickly do a bare-minimum install to see if my list of steps work. Sometimes my other actions in the server would cause problems so it's important that the bare-minimum install works before I look at other factors.

As for Passenger you can't rely on its generated error messages 100%. Sometimes you could be missing an index.html file or a view file but if you read Passenger's error it's like you messed up ten different things.

I recently got Passenger to work from scratch so here's list of what I did:

  • Did not touch anything with regards to permission (other than what you've done_I just did the CHOWN step; no CHMOD step).
  • Did not have to touch config.ru or config/environments.rb
  • Cleared tmp using rm -rf /tmp/*
  • I installed from gemfile (not tarball); ran the gem install passenger cmd (with a 2GB swap).
  • Ran the passenger-install-apache2-module cmd. Passenger will give 5 lines of code to paste into httpd.conf at the end. Did that.

Virtualhost config looks like this:

<VirtualHost *:80>
    ServerName www.domain.com
    DocumentRoot /var/www/html/app/public
    <Directory /var/www/html/app/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

Restart apache and that's it!

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Mr Red
  • 191
  • 1
  • 3
0

Passenger is a module for Apache, running as part of the Apache process. This means the Apache user needs to have the permissions to the project. From the Passenger documentation for Apache:

You may also need to tweak your file/folder permissions. Make sure that the following folders are readable and executable by Apache:

* this public folder.

* the application’s config folder.

* all parent folders. That is, /webapps/rackapp and /webapps must also be readable and executable by Apache.
mguymon
  • 101
  • 2
  • OK. I modified my permissions and granted the www-data group read & execute permissions on all folders and files from /home/ on down just to open things up for troubleshooting. I am still getting the same Passenger message. Passenger-status shows that Passenger is indeed running and mysql is up and running too. I have touched the /tmp/restart.txt file as well as restarted Apache to no avail. –  Nov 16 '12 at 10:46
0

Your PassengerAppRoot is wrong. You specified /home/admin/www/app but your app is actually in /home/admin/www/app/current. This is why Passenger can't find it.

The resolution is to fix the configuration.

    PassengerAppRoot /home/admin/www/app/current
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940