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:
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
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.