1

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.

1 Answer 1

2

You want RackBaseURI rather than RailsBaseURI for >=3.0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.