开发者

Passenger+nginx: Hosting a Rails application in a subdirectory

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 Rou开发者_开发知识库tingError. 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?


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 http://img190.imageshack.us/img190/8898/32380822.png

Here are the Nginx instructions:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜