如何在非root上下文中运行Rails应用程序? [英] How can I run my Rails application in a non-root context?
问题描述
我在非特权环境中工作,我的Rails应用程序的根网址是 http://foo.com/bar
。
I'm working in a non-privileged environment, and my Rails application's root url is http://foo.com/bar
.
告诉Rails最简单的方法是,例如我的样式表在 / bar / stylesheets
不要 / stylesheets
,并使 model_url
指向 / bar / model / baz
而不是 / model / baz
?
What is the simplest way to tell Rails that, for example, my stylesheets are in /bar/stylesheets
, not /stylesheets
, and make model_url
point to /bar/model/baz
instead of /model/baz
?
推荐答案
你运行应用程序到该特定路径的方式(是 script / server --path = / sub-uri
或者具有将旅客部署到目录)您不需要更改代码,因为网址助手会自动调整他们对环境的路径。
Regardless of the way you are running the application to that specific path (be it script/server --path=/sub-uri
or have deployed passenger to a directory) you don't need to change the code as the url helpers will automatically adjust their path to the environment.
这篇关于如何在非root上下文中运行Rails应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!