我的rails应用程序只会在我转到网址时显示公共目录。 我正在使用apache,passenger和ubuntu。 我的apache virtualhosts文件是;
<VirtualHost *:80>
ServerName www.phusion.nl
DocumentRoot /websites/phusion
<Directory /websites/phusion>
Allow from all
</Directory>
# These have been added:
Alias /subapp /websites/rails/public
<Location /subapp>
PassengerBaseURI /subapp
PassengerAppRoot /websites/rails
</Location>
<Directory /websites/rails/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
我认为一切都安装正确,我的config.ru是;
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
我已将以下内容添加到apache2.conf;
LoadModule passenger_module /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35
PassengerDefaultRuby /home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby
</IfModule>
apache error.log给出;
All Phusion Passenger agents started!
[ 2014-01-19 09:05:23.8076 12140/7f1e3695c740 agents/Watchdog/Main.cpp:526 ]:
Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35', 'passenger_version' => '4.0.35', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.35', 'web_server_pid' => '12137', 'web_server_type' => 'apache', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
答案 0 :(得分:5)
...咄
我将PassengerAppRoot
设置为 public 文件夹,而不是rails
root。
答案 1 :(得分:3)
此问题可能是因为您安装Passenger模块的方式
错误方式:sudo passenger-install-apache2-module
正确方式:rvmsudo passenger-install-apache2-module
我只是猜测你使用了导致这个问题的第一个,如果我错了请纠正我。