views:

432

answers:

1

I'm trying to deploy an application in a subdirectory /a under www.myserver.com, following the steps in the Passenger docs here: http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri

This seems to work, but the Rails routes are now all expecting the additional subdirectory /a, such that trying to access the root www.myserver.com/a gives me a RoutingError. I've tried setting relative_url_root, but that changes nothing. Do I need to add the prefix /a to every route in my routes file?

+1  A: 

Hmmm...all seems to have worked fine for me. Just tried it.

Are you sure you followed the Nginx instructions instead of the Apache instructions?

Make sure you do the soft link and change the 'root' application...the instructions say to make it the absolute path minus the 'public' part:

http { ...

server {
    listen 80;
    server_name g.local;
    root /home/bernie/development/test;  <- forgot to change this the first time I tried
    passenger_enabled on;   
    passenger_base_uri /rails; 
}

...

}

Here's an image of the end result...no route modifications needed:

alt text

Here are the Nginx instructions:

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_uri

btelles
If I understood his question he wants to have a rails app under the root app not change the path root app adding a superfluous directory name. For instance if you want to host several different apps under www.myhost.com like www.myhost.com/app1 www.myhost.com/app2 www.myhost.com/app3 which are all different rails apps. Your answer doesn't address that but instead unnecessarily adds an extra path to the root URL.
Mike Bethany