作者rabbithenry (欢迎光临Wiiholic.com)
看板Ruby
标题[问题] 关於Apache同时跑PHP跟ROR的问题
时间Sun Mar 2 01:51:12 2008
平时写ROR都是直接在Webrick上跑,这次要上线运行发现了问题。
我要上线的主机不是只有我一个人使用的,上面平时是执行PHP,但是有安装Ruby跟Rails
原本想经由FastCGI来跑,但是我设好以 RailsProjectPath/public 的方式测试执行时
会直接出现下面这样
#!/usr/bin/ruby1.8
#!/usr/local/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# and the GC period is nil (turned off). A reasonable number of requests
# could range from 10-100 depending on the memory footprint of your app.
#
# Example:
# # Default log path, normal GC behavior.
# RailsFCGIHandler.process!
#
# # Default log path, 50 requests between GC.
# RailsFCGIHandler.process! nil, 50
#
# # Custom log path, normal GC behavior.
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
#
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
RailsFCGIHandler.process!
看起来是直接把 public/dispatch.fcgi 给直接列出来了,这是代表我有什麽地方出错吗
?
我後来尝试用Mogrel+Apache来跑,但是设定完成後是跑出来了,可是却直接指向Mogrel
其他PHP网页全都跑不出来了,所以也只好直接放弃。
这主机不是只有我一个人在跑,所以我不能把整个IP都指向Mongrel,可以单纯指定某个
Domain到Mongrel而已吗?一般外面的虚拟主机支援ROR都是怎麽做的呢?
因为只是个小公司行号网站,并不会有太大的流量,所以我想Apache+FCGI的方式应该是
可以,只是不知道我漏掉了什麽步骤呢?
我的作法是
1. 让Apache支援FCGI
2. 修改专案中的.htaccess 支援FCGI
3.
http://domainname/railsproject/public/ 的方式来试跑就跑出上面的那一大串了,
我在Dreamhost的主机下这样跑是OK的
烦请各位帮忙解答,我已经弄这个弄到头痛了... 谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.116.172.228
1F:推 shelary:我都不用FastCGI.很容易当掉.. 03/02 02:05
2F:→ shelary:我用Mogrel+ApacheReverseProxy.同时跑十几个ROR站和PHP站 03/02 02:05
3F:→ rabbithenry:你是怎麽做的呢?我设定好Mongrel,输入Domain就直接 03/02 02:10
4F:→ rabbithenry:跳到我的Rails专案去了 03/02 02:10
5F:→ rabbithenry:我找到一个用指定VirtualHost的方式来运作,明天试试 03/02 02:52
6F:推 godfat:virtual host + mongrel 应该就可以了 03/02 07:20