Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to host multiple Rails apps on a multiple server using sub-directories. And have encountered some relative path problems.

I have made a symbolic link to the app's public directory and placed it in the /var/www/html directory,

var/www/html/
            /test_app (symbolic link to the public folder of test_app) 

and set apache as so

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.12
   PassengerRuby /usr/local/bin/ruby

   <VirtualHost *:80>
      ServerName  test.com
      DocumentRoot /var/www/html

      Options Indexes FollowSymLinks -MultiViews

      RailsBaseURI /test_app

      </Location>
   </VirtualHost>

The links in the app itself works just fine, all the links acknowledge the test_app/ directory and work, however, when it comes to showing images in the public directory in the view, the relative path goes wrong.

Say I have

/system/files/1/aaa.png

it goes looking for it in

/var/www/html/system/files/1/aaa.png

rather than

/var/www/html/test_app/system/files/1/aaa.png

As far as I understand this is an Apache setting problem than something to be done in Rails, if its possible I would prefer to have it contained in the conf file of apache rather than having to alter the code.

share|improve this question

1 Answer 1

You want RackBaseURI rather than RailsBaseURI for >=3.0

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.