5

I am setting up a new server which I intend to host multiple Ruby on Rails applications on.

The server is running Ubuntu 10.04 LTS and I have set the Apache virtual hosts up so each application has it's own sites-available configuration file (pointing at the Rails public directory). I have then made a symbolic link from sites-enabled/(CONFIG FILE HERE) to sites-available/(CONFIG FILE HERE).

Sites Available

root@HAH-UBUNTU-GER /etc/apache2/sites-available # ls
default  default-ssl  application1.com  application2.com

Sites Enabled (Symbolic links)

root@HAH-UBUNTU-GER /etc/apache2/sites-enabled # ls
000-default  application1.com  application2.com

More information on the symbolic links:

root@HAH-UBUNTU-GER /etc/apache2/sites-enabled # ls -l
total 0
lrwxrwxrwx 1 root root 26 2012-05-04 11:41 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 39 2012-05-04 12:28 application1.com -> ../sites-available/application1.com
lrwxrwxrwx 1 root root 37 2012-05-04 12:09 application2.com -> ../sites-available/application2.com

I have uploaded all of the Rails application files to /var/www/vhosts/application1.com and made sure the Apache configuration file is pointed at the public directory.

Bundler, ruby gems etc. works but I can't get Passenger to load the application.

As usual, I have set the server up using a bash script which contains the following section which relates to the Passenger installation:

# Install and setup the Apache Passenger Module
yes '' | sudo /usr/local/bin/passenger-install-apache2-module

# Add the Passenger config to /etc/apache2/httpd.conf
sudo cat > /etc/apache2/httpd.conf << HTTPD_CONF
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-      3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11
PassengerRuby /usr/local/bin/ruby
HTTPD_CONF

The full virtual host configuration file for application1.com is:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName application1.com
    DocumentRoot /var/www/vhosts/application1.com/public
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/vhosts/application1.com/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </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

If it makes a difference, I am accessing the website by editing my hosts file to point the server IP address at the individual domains.

When I visit the domain I get a listing of the public directory:

Directory Listing of /public

I assume I am doing something blindingly obviously wrong but I can't figure it out. Any help would be appreciated.

For more information the full bash script I use is here: https://raw.github.com/deanperry/onelineserver/master/ruby192.sh

UPDATE

Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 reqtimeout_module (shared)
 setenvif_module (shared)
 status_module (shared)
Syntax OK
dannymcc
  • 2,677
  • 10
  • 46
  • 72
  • 1
    Does Apache load the passenger module succesfully? What is the output of `sudo apache2ctl -t -D DUMP_MODULES`? –  May 04 '12 at 12:14
  • It does look like something's keeping Passenger from running at all. There are a bunch of options; the rational first thing to check is that the module loaded. – pjmorse May 04 '12 at 16:13
  • Eh, take out the `Indexes` and replace `Multiviews` with `-Multiviews`.Then restart – qweet May 04 '12 at 18:44
  • Passenger module doesn't appear in the list of loaded modules (See updated question) – dannymcc May 04 '12 at 19:11
  • in which case- run `passenger-install-apache2-module` from the commandline and see what happens – qweet May 04 '12 at 19:23
  • I've just done that and then added the correct info to apache2.conf but I get '# passenger-status /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- phusion_passenger/admin_tools/control_process (LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/sbin/passenger-status:27:in `
    ' when running passenger-status.
    – dannymcc May 04 '12 at 19:36
  • Did you need to sudo? – MaddHacker May 14 '12 at 21:19

1 Answers1

4

Based on the documentation, you will need to disable MultiViews on the passenger sites. Additionally, your DocumentRoot should point to the directory containing public--i.e., Passenger checks to see if the selected directory contains a passenger application by checking for {DocumentRoot}/../config/environment.rb, so verify that this is correct.

If you're still stumped, enable logging and figure out why it doesn't think you have a Passenger application at that location.

Andrew M.
  • 10,982
  • 2
  • 34
  • 29