Edgars Edgars - 1 month ago 5
Ruby Question

Rails 3 application on main domain

I have domain www.ecotechno.lv. I want to link this domain with my RoR application.

I have done like this:

uploaded my app in /rails_apps folder

created symlink:

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


Populated /rails_apps/ecotechno/public folders .htacces file with:
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>


This is done by folowing hosting company's guide!

Now when I browse www.ecotechno.lv where it should start my rails app. it shows filesystem and that ecotechno symlink. When I click it gives error:

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


But why I can't start my app in first place after browsing ecotechno.lv ? You can check www.ecotechno.lv if it can help.

Thanks in advance!

ecotec11@ecotechno.lv [~]# 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/

Answer

Thanks for all. So I fixed this.

My solution.

1) Rails apps has to be in ../rails_apps/eco

2) Created symlink with this : ln -s ~/rails_apps/eco/public ~/public_html/eco

3) In public_html/.htaccess insert this code :

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) In rails_apps/eco/public/.htaccess : leave it blank.

So I hope somebody it helps.

Comments