2011-04-11 26 views
1

我試圖讓兩個Ruby應用程序從同一端口工作。我根本不知道服務器技術,所以請原諒我的無知。我試圖按照此文檔:一個端口上的多個Ruby應用程序,RackBaseURI幫助

http://www.modrails.com/documentation/Users%20guide%20Apache.html

部分4.1 - 4.3,但我一直搞亂的東西了。我試圖簡化一點,所以這是我的情況。我有兩個簡單的rackup應用在這裏:

/用戶/張丹/ webapps /目錄test1的 /用戶/張丹/ webapps /下test2的

他們每個人都有了 「config.ru」 文件,公共/文件夾,按照說明,帶有「restart.txt」的tmp /文件夾。他們都是自己工作的。

我在httpd.conf文件如下:

<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot /Users/dan/webapps 
    <Directory /Users/dan/webapps> 
     Allow from all 
    </Directory> 
    RackBaseURI /test1 
    <Directory /Users/dan/webapps/test1> 
    Options -MultiViews 
    </Directory> 
    RackBaseURI /test2 
    <Directory /Users/dan/webapps/test2> 
    Options -MultiViews 
    </Directory> 
</VirtualHost> 

我啓動Apache,然後把這個在我的瀏覽器:http://localhost/test1。我得到:

故宮

您沒有權限訪問此服務器上的/ test1的。

我並不感到驚訝它不起作用,因爲我應該設置一個符號鏈接,但我不知道如何將其應用於我的設置。下面是從文檔的例子:

LN -s/webapps /下rackapp /公/網站/ PHUSION /機架

你能告訴我如何設置的符號鏈接,讓我知道,如果你看到什麼其他錯誤?請給「傻瓜」答案,這個東西讓我很難過。謝謝!

+0

是您的Apache服務器能夠從這些目錄閱讀? – 2011-04-11 23:20:45

回答

0

phylae,我認爲您可能會在符號鏈接中反轉路徑。爲了得到它的工作,我改變了鏈接名稱爲清楚:

<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot /Users/dan/webapps 
    <Directory /Users/dan/webapps> 
     Allow from all 
    </Directory> 
    RackBaseURI /test1link 
    <Directory /Users/dan/webapps/test1> 
    Options -MultiViews 
    </Directory> 
    RackBaseURI /test2link 
    <Directory /Users/dan/webapps/test2> 
    Options -MultiViews 
    </Directory> 
</VirtualHost> 

然後,符號鏈接:

LN -s /用戶/張丹/ webapps /下測試1 /公/用戶/擔/ webapps中/ test1link

LN -s /用戶/張丹/ webapps /下測試2 /公/用戶/張丹/ webapps /下test2link

然後這些URL按預期在瀏覽器中。

http://localhost/

http://localhost/test1link

http://localhost/test2link

0

要創建符號鏈接,試試這個:

ln-s /Users/dan/webapps/test1 /Users/dan/webapps/test1/public 
ln-s /Users/dan/webapps/test2 /Users/dan/webapps/test2/public 

然而,正如克里斯polzer提到的,你還需要檢查你的Apache用戶可以從這些目錄中讀取。

如果你不知道該怎麼做,然後發佈這些命令的輸出:

ls -l /Users/dan/webapps/test1 
ls -l /Users/dan/webapps/test2. 
ps -aux | grep http 
ps -aux | grep apache 

您可能還需要檢查所有的父目錄的權限。即/ Users,/ Users/dan和/ Users/dan/webapps。請參閱:http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root_2

相關問題