我有一个 Rails 应用程序,我想通过 apache 在默认端口 80 上运行它。所以我设置了Passenger服务器并配置了apache配置文件。
我的应用程序曾经在默认的 3000 端口上运行,而我的 routes.rb 看起来像这样:
ScwCentral::Application.routes.draw do
resources :smoke
resources :regression
.....
....
.....
这些是我的应用程序“烟雾”和“回归”中的 2 个控制器。所以我的应用程序将在 localhost:3000/smoke 和 localhost:3000/regression 之类的 url 上运行。
现在,在设置好乘客服务器和所有内容之后,我将 apache 配置文件编辑为:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19
PassengerRuby /usr/local/bin/ruby
# Rails_App Virtual Host
<VirtualHost *:80>
ServerName www.mysite.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /a/rails_app_test/public/
<Directory /a/rails_app_test/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
其中“/a/rails_app_test/”是我的应用程序的路径。
现在当我去 www.mysite.com 它说
Routing Error
No route matches [GET] "/"
当我打开 www.mysite.com 时,我最好打开 localhost:3000/smoke。我需要在配置文件中进行更多更改吗?