我正在build立一个新的服务器,我打算主持多个Ruby on Rails应用程序。
服务器运行的是Ubuntu 10.04 LTS,我已经设置了Apache虚拟主机,这样每个应用程序都有自己的站点可用configuration文件(指向Rails公共目录)。 然后,我从sites-enabled/(CONFIG FILE HERE)到sites-available/(CONFIG FILE HERE)的符号链接。
网站可用
root@HAH-UBUNTU-GER /etc/apache2/sites-available # ls default default-ssl application1.com application2.com
网站已启用(符号链接)
root@HAH-UBUNTU-GER /etc/apache2/sites-enabled # ls 000-default application1.com application2.com
有关符号链接的更多信息:
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
我已将所有Rails应用程序file upload到/var/www/vhosts/application1.com ,并确保Apacheconfiguration文件指向公共目录。
Bundler,ruby等工程,但我不能得到乘客来加载应用程序。
像往常一样,我已经使用bash脚本设置服务器,其中包含以下与Passenger安装相关的部分:
# 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
application1.com的完整虚拟主机configuration文件是:
<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
如果有所不同,我通过编辑我的主机文件来访问网站,以指向各个域的服务器IP地址。
当我访问域时,我得到了公共目录的列表:

我假设我正在做一些盲目明显的错误,但我无法弄清楚。 任何帮助,将不胜感激。
有关更多信息,我使用的完整bash脚本在这里: 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
根据文档 ,您将需要禁用客运站点上的MultiView。 另外,你的DocumentRoot应该指向包含public的目录 – 也就是说,Passenger 检查是否通过检查{DocumentRoot}/../config/environment.rb 来查看所选目录是否包含乘客应用程序 ,因此请validation这是否正确。
如果你仍然难住, 启用日志logging,并找出为什么它不认为你有一个Passenger应用程序在该位置。