看板 Ruby 關於我們 聯絡資訊
我現在的情況是 apache 本身有網站在執行, 然後我新增的 mongrel 實體來跑我的程式時, 我的設定會把 http://localhost/ 整個轉到 mongrel 下, 但是我想要的情況是 http://localhost/myapp/ 才會轉到我的 mongrel 下, 請問要怎麼設定我的 virtual host 才可以這樣跑, 或者是說有別種的方法來實現我的架構? 以下是我的 virtual host 的設定 <VirtualHost *:80> AddDefaultCharset utf-8 ServerName * DocumentRoot C:\ruby\workspace\myapp\public ErrorDocument 500 /500.html ErrorDocument 404 /404.html ProxyPass / http://localhost:4000/ ProxyPassReverse / http://localhost:4000/ ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! #continue with other static files that should be served by apache Alias /images C:\ruby\workspace\myapp\public\images Alias /stylesheets C:\ruby\workspace\myapp\public\stylesheets Alias /javascripts C:\ruby\workspace\myapp\public\javascripts #continue with aliases for static content <Proxy *> Order deny,allow Allow from all </Proxy> <Directory C:\ruby\workspace\myapp\public\> Options Indexes FollowSymLinks Order allow,deny allow from all </Directory> </VirtualHost> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.86.97.171
deduce:我是覺得...這已經不是Ruby or Rails的問題了,這是Apache. 09/10 01:10
shelary:我猜是 ProxyPassReverse /myapp http://localhost:4000/ 09/10 01:46
shelary:不過這的確跟 ruby 無關耶..@_@ 09/10 01:47
dream1129:我用 ProxyPass myapp http://localhost:4000/ 就可以在 09/10 02:07
dream1129:http://localhost/myapp 讀到我 mongrel 的首頁,但是 09/10 02:08
dream1129:我沒辦法執行我的controller 09/10 02:10
dream1129:XD 雖然跟 Ruby 沒關係,可是我不知道要去哪 po 09/10 02:11
shelary:那你 config/routes.rb 要改丫 09/10 02:24
dream1129:可以指點我一下嗎,因為接觸 ruby 不久,霸拖了~ 09/10 02:29
shelary:大概是 map.connect 'myapp/:controller/:action/:id' 09/10 02:33
dream1129:可以了!但是我的 localhost 還是被 mongrel 蓋掉了 09/10 02:35
dream1129:有辦法解決這個問題嗎? 這好像也是 apache 的設定問題 09/10 02:36
dream1129:因為我 virtual host 還是 80 09/10 02:36
shelary:apache有 / 的都要改丫.. ProxyPass / ! 09/10 02:36
godfat:就說不要推那麼長啊啊啊 09/10 12:16
※ 編輯: dream1129 來自: 219.86.99.66 (09/10 14:19)