2014-09-27 63 views
0

我有域名www.ecotechno.lv。我想將此域名與我的RoR應用程序鏈接。主要域上的Rails 3應用程序

我做這樣的:

上傳我的應用程序在/ rails_apps文件夾

創建符號鏈接:

ln -s ~/rails_apps/ecotechno/public ~/public_html/ecotechno 

填充的/ rails_apps/ecotechno /公共文件夾.htacces與文件: PassengerAppRoot/home3/ecotec11/rails_apps/ecotechno/

<IfModule mod_passenger.c> 
Options -MultiViews 
PassengerResolveSymlinksInDocumentRoot on 
#Set this to whatever environment you'll be running in 
RailsEnv development 
RackBaseURI/
SetEnv GEM_HOME /home3/ecotec11/ruby/gems/gems 
</IfModule> 

這是通過託管公司的指導!

現在,當我瀏覽www.ecotechno.lv它應該啓動我的rails應用程序。它顯示文件系統和那個符號鏈接。當我點擊它給了錯誤:

Ruby (Rack) application could not be started 
Error message: 
Could not find rename-1.0.2 in any of the sources (Bundler::GemNotFound) 

但爲什麼我不能瀏覽ecotechno.lv之後開始我的應用程序在首位?如果可以幫助,您可以檢查www.ecotechno.lv

在此先感謝!

[email protected] [~]# ls -l ~/rails_apps/ecotechno/public 
total 32 
drwxr-xr-x 3 ecotec11 ecotec11 4096 Sep 27 14:30 ./ 
drwxr-xr-x 13 ecotec11 ecotec11 4096 Jul 24 02:39 ../ 
-rw-r--r-- 1 ecotec11 ecotec11 301 Sep 27 14:27 .htaccess 
-rw-r--r-- 1 ecotec11 ecotec11 728 Feb 5 2014 404.html 
-rw-r--r-- 1 ecotec11 ecotec11 711 Feb 5 2014 422.html 
-rw-r--r-- 1 ecotec11 ecotec11 643 Feb 5 2014 500.html 
-rw-r--r-- 1 ecotec11 ecotec11 0 Feb 5 2014 favicon.ico 
-rw-r--r-- 1 ecotec11 ecotec11 204 Feb 5 2014 robots.txt 
drwxr-xr-x 5 ecotec11 ecotec11 4096 Jun 9 11:38 system/ 
+2

你有捆綁安裝嗎?看起來所需的gem沒有安裝在你的機器上。 – brahmana 2014-09-27 20:11:25

+0

@brahmana我捆綁了它,但那個錯誤是可以的。但我不明白爲什麼它不顯示它,當我瀏覽ecotechno.lv – Edgars 2014-09-27 20:12:58

+1

我不明白你什麼意思'當我瀏覽器ecotechno.lv'。我只是嘗試了'http:// ecotechno.lv/ecotechno /'和'http:// www.ecotechno.lv/ecotechno /',對於他們兩個我都看到同樣的錯誤。沒有找到寶石。你確定寶石安裝到/ home3/ecotec11/ruby​​/gems/gems嗎?試試app目錄下的'bundle show rename'來查看是否真的安裝了gem。也可以嘗試'gem list --local rename *' – brahmana 2014-09-27 20:17:24

回答

1

謝謝大家。 所以我解決了這個問題。

我的解決方案。

1)Rails應用必須處於../rails_apps/eco

2)創建的符號鏈接與此:ln -s ~/rails_apps/eco/public ~/public_html/eco

3)在的public_html/htaccess的插入此代碼:

PassengerAppRoot /home3/ecotec11/rails_apps/eco/ 

<IfModule mod_passenger.c> 
Options -MultiViews 
PassengerResolveSymlinksInDocumentRoot on 
#Set this to whatever environment you'll be running in 
RailsEnv development 
RackBaseURI/
SetEnv GEM_HOME /home3/ecotec11/ruby/gems/gems 
</IfModule> 

RewriteEngine On 

RewriteCond %{HTTP_HOST} !^www.ecotechno.lv$ [NC] 
RewriteRule ^(.*)$ http://www.ecotechno.lv/$1 [L,R=301] 
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L] 

RewriteCond %{HTTP_HOST} ^173\.254\.28\.107 
RewriteRule (.*) http://www.ecotechno.lv/$1 [R=301,L] 

4)在rails_apps /生態/公/的.htaccess:留空。

所以我希望有人幫助。

+0

感謝哥們。 :) – 2016-10-21 13:30:23