ruby-on-rails-4 - 在子文件夹下运行 rails app

标签 ruby-on-rails-4 deployment routes

我一直在 localhost:3000 上测试我的 Rails 应用程序,它工作得很好。但是,当部署到我的主机时,根 URL 是:

http://99.88.77.66/~username

我目前没有域名。

当我将浏览器指向上述 URL 时,我得到找不到根:

/~用户名

替代

http://99.88.77.66/~username/controller/index

我找不到这条路线:

/~用户名/ Controller /索引

我正在使用 Rials 4.2.3 和 Ruby 2.0。

在获得合适的域名之前,如何使我的路由与此类子文件夹一起工作?

最佳答案

尝试在 config/environments/production.rb 中设置 config.relative_url_root:

http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root

关于ruby-on-rails-4 - 在子文件夹下运行 rails app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31883197/

相关文章:

ruby-on-rails - #<ActionDispatch::Http::UploadedFile:0xa5741c0> 的未定义方法 `each'

ruby-on-rails - 如何 DRY 我在 5 个模型中编写的 has_attached_file

linux - Kohana_HTTP_Exception [404] : The requested URL/was not found on this server

php - 开发与生产数据库

c# - 避免 ASP.Net Core 中的 "Request matched multiple actions resulting in ambiguity"错误

ruby-on-rails - 默认: { action: 'method' } do in rails routes?是什么

css - 耙 Assets :precompile gives no erros but mina deploy fails on running the same command

ruby-on-rails-4 - redirect_to 在包含条件子句之后抛出禁止?

c# - 无法找到请求的 .Net Framework 数据提供程序 - SQLite

asp.net - 在网站上线时重新发布 ASP.NET Web 应用程序