JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Languages on JVM » JRuby  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 [求助] Ruby on Rails on Windows with Apache 架不起來
jhkao





發文: 10
積分: 0
於 2008-04-11 02:19 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
各位先進您們好:

我是RoR的初學者,因為研究需要想架設一個RoR網站,網站在開發環境利用Mongrel來Run都已經沒有問題,現在想Production在Apache上,爬了兩三天的文還是作不出來,想請各位先進給我一點提示。

環境:
======================
OS:Windows Server 2003
Apache:2.2.8
Ruby:1.8.6
Rails:1.2.2
DB:DB2 v9
mongrel:1.1.3
mongrel_service:0.3.4
======================

我的作法是第一步利用mongrel_rails建立三個服務,如下:
mongrel_rails service::install -N depot1 -c e:\railsapp\depot -p 3000 -e production
mongrel_rails service::install -N depot2 -c e:\railsapp\depot -p 3001 -e production
mongrel_rails service::install -N depot3 -c e:\railsapp\depot -p 3002 -e production
之後確實有在「電腦管理」>「服務」的地方看到這三個服務,並將其啟動。

接著利用瀏覽器輸入網址:http://localhost:3000/也確實能夠使用,因此我認為mongrel端應該沒有問題。

接著我在Apache的組態檔httpd.conf檔中,啟用了三個模組,如下:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so

接著在整份文件的最下面加入:
<Proxy balancer://myCluster>
BalancerMember http://localhost:3000
BalancerMember http://localhost:3001
BalancerMember http://localhost:3002
</Proxy>

<VirtualHost *:80>
ServerName f12-206.twisc.ntust.edu.tw
DocumentRoot e:/railsapp/depot_r/public
ProxyPass /depot balancer://myCluster
ProxyPassReverse /depot balancer://myCluster
ProxyPreserveHost on
</VirtualHost>

最後的結果是我在瀏覽器輸入網站 http://f12-206.twisc.ntust.edu.tw 時,會出現我沒有權限的錯誤訊息,如下:
============================
Forbidden

You don't have permission to access / on this server.
============================
而我輸入 http://f12-206.twisc.ntust.edu.tw/depot/ 時,則會出現:
============================
Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /depot/.

Reason: Error reading from remote server
============================

我已經弄了兩三天弄不出來了,想請教各位先進是否有遇到類似的問題,能否給我一點提示呢??


reply to postreply to post
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
koji

秒速5センチメートル

站長

發文: 8415
積分: 19
於 2008-04-11 09:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://www.javaeye.com/topic/43290

http://lightyror.thegiive.net/2006/12/apache-22-mongrel.html

參考過?
mod_proxy_balancer.so
這好像你就沒有?
看看再try一次吧

koji


reply to postreply to post
JCConf Taiwan 2015 開始售票了!!
Facebook上的TWJUG社團,歡迎加入
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
jhkao





發文: 10
積分: 0
於 2008-04-11 10:32 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
是的,這兩篇我都參考過,也照上面的方法設定但還是沒辦法成功。
mod_proxy_balancer.so 我的啟用,忘了寫,不好意思。

我覺得問題會不會是出在Apache的設定上面,不曉得版上有沒有前輩可以借我參考一下你們 Proxy 和 VirtualHost 的設定呢?


reply to postreply to post
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
weijenlu





發文: 30
積分: 6
於 2008-04-11 11:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我看http://www.javaeye.com/topic/43290這篇說得,
我覺得可能是:
1. Apache 設定要加 ProxyRequests Off
2. 你有firewall嗎? 把firewall關掉看看。


reply to postreply to post
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
jhkao





發文: 10
積分: 0
於 2008-04-11 12:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ProxyRequests Off 我有加了

firewall我也都關閉了,也都一樣,真難搞…


reply to postreply to post
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
koji

秒速5センチメートル

站長

發文: 8415
積分: 19
於 2008-04-17 17:06 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
service加上-B看看log
mongrel parse header出現錯誤
然後我把log內的request丟到test去跑
apache送出來的內容以下這段
Connection: Keep-Alive\r\nGET /test/show HTTP/1.1\r\n
造成錯誤的樣子!?

HTTP parse error, malformed request (127.0.0.1): #<Mongrel::HttpParserError: Invalid HTTP format, parsing fails.>

REQUEST DATA: "GET /test/show HTTP/1.1\r\nHost: www.testkoji.com\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-tw,en-us;q=0.7,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: Big5,utf-8;q=0.7,*;q=0.7\r\nX-Forwarded-For: 127.0.0.1\r\nX-Forwarded-Host: www.testkoji.com\r\nX-Forwarded-Server: www.testkoji.com\r\nConnection: Keep-Alive\r\nGET /test/show HTTP/1.1\r\nHost: www.testkoji.com\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: zh-tw,en-us;q=0.7,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: Big5,utf-8;q=0.7,*;q=0.7\r\nX-Forwarded-For: 127.0.0.1\r\nX-Forwarded-Host: www.testkoji.com\r\nX-Forwarded-Server: www.testkoji.com\r\nConnection: Keep-Alive\r\n\r\n"
---
PARAMS: {"HTTP_X_FORWARDED_HOST"=>"www.testkoji.com", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5", "HTTP_ACCEPT_LANGUAGE"=>"zh-tw,en-us;q=0.7,en;q=0.3", "HTTP_HOST"=>"www.testkoji.com", "REQUEST_PATH"=>"/test/show", "HTTP_ACCEPT_CHARSET"=>"Big5,utf-8;q=0.7,*;q=0.7", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_X_FORWARDED_SERVER"=>"www.testkoji.com", "REQUEST_URI"=>"/test/show", "HTTP_X_FORWARDED_FOR"=>"127.0.0.1", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "HTTP_CONNECTION"=>"Keep-Alive", "REQUEST_METHOD"=>"GET"}

koji


reply to postreply to post
JCConf Taiwan 2015 開始售票了!!
Facebook上的TWJUG社團,歡迎加入
作者 Re:[求助] Ruby on Rails on Windows with Apache 架不起來 [Re:jhkao]
jhkao





發文: 10
積分: 0
於 2008-04-22 17:57 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我後來使用InstantRails架起來了,只要對Apache的httpd.conf作一些修改,將虛擬目錄指到我的Rails服務即可,謝謝各位。

reply to postreply to post
» JWorld@TW »  Languages on JVM » JRuby

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8