在子文件夹下运行Rails应用 [英] Run rails app under subfolder
问题描述
我已经在localhost:3000上测试了我的Rails应用程序,并且运行正常。但是,当部署到我的主机时,根URL为:
I've been testing my rails app on localhost:3000 and it works just fine. However, when deploying to my host, the root URL is:
我目前没有域名。
当我将浏览器指向上述URL时,找不到以下内容的根目录:
When I point the browser to the above URL I get the root not found for:
/〜用户名
或者
http: //99.88.77.66/~username/controller/index
我找不到此路由:
/〜用户名/控制器/索引
/~username/controller/index
我正在使用Rials 4.2.3和Ruby 2.0。
I'm using Rials 4.2.3 and Ruby 2.0.
在获得合适的域名之前,如何使路由与此类子文件夹一起使用?
How can I make my routes work with this kind of subfolder until I can get an appropriate domain name?
推荐答案
尝试设置 config / environments / production.rb
中的 config.relative_url_root
:
http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
这篇关于在子文件夹下运行Rails应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!