[英]Run rails app under subfolder
I've been testing my rails app on localhost:3000 and it works just fine. 我已经在localhost:3000上测试了我的rails应用程序,并且运行正常。 However, when deploying to my host, the root URL is: 但是,当部署到我的主机时,根URL是:
http://99.88.77.66/~username http://99.88.77.66/~用户名
I do not have a domain name at this point. 我目前没有域名。
When I point the browser to the above URL I get the root not found for: 当我将浏览器指向上述URL时,找不到以下内容的根目录:
/~username /〜用户名
Alternatively for 或者
http://99.88.77.66/~username/controller/index http://99.88.77.66/~username/controller/index
I get this route not found: 我得到此路由未找到:
/~username/controller/index /〜用户名/控制器/索引
I'm using Rials 4.2.3 and Ruby 2.0. 我正在使用Rials 4.2.3和Ruby 2.0。
How can I make my routes work with this kind of subfolder until I can get an appropriate domain name? 在获得适当的域名之前,如何使这种路由与此类子文件夹一起使用?
Try setting config.relative_url_root
in config/environments/production.rb
: 尝试在config/environments/production.rb
设置config.relative_url_root
:
http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.