作者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