我正在尝试将rails 3应用程序部署到Windows机器上(是的,它必须是Windows,我不能使用linux)
我决定尝试使用Mongrel + Apache(如果有人知道有效的话,我愿意尝试其他设置)。
我安装了mongrel,我可以运行rails server mongrel并运行我的应用程序。但是当我尝试使用
启动mongrel作为Windows服务时mongrel_rails service::install -N mongrel1 -e production -p 3001 -c mydirectory`
我遇到了麻烦。服务器启动正常但当我尝试进入网页时,我在mongrel.log
文件中生成了以下错误。
Error calling Dispatcher.dispatch #<NameError: uninitialized constant ActionController::CgiRequest>
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/rails.rb:76:in `block in process'
<internal:prelude>:10:in `synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/rails.rb:74:in `process'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:165:in `block in process_client'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:164:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:164:in `process_client'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:291:in `block (2 levels) in run'
我试图阅读此内容,但所有设置指南似乎都过时了。
答案 0 :(得分:0)
我使用Apache + Mongrel在Windows(Win7)上运行Rails 3应用程序。这可能是另一种方法。在httpd.conf中,我将DocumentRoot设置为我的rails应用程序的路径。然后将Directory标记设置为Document Root。然后添加VirtualHost标记,如下所示:
<VirtualHost localhost:80>
Servername YourAppServer
DocumentRoot "same path as before"
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost On
</VirtualHost>"
我认为ServerName值是任意的。
您还需要添加: LoadModule proxy_module modules / mod_proxy.so LoadModule proxy_http_module modules / mod_proxy_http.so
我想如果您使用的是端口3001而不是3000,那么您可以进行相应的替换。
然后使用'rails server -e production -p 3001'启动所有内容(来自您的app文件夹)(Apache应该已经在运行)