您可以将 RoR 应用程序解析到公共文件夹吗?
几周来我一直在网络解决方案方面来来回回。他们只有一个文件上传按钮来上传您的应用程序,仅此而已。无法启动应用程序或通过 SSH 连接到服务器。当我明确遵循他们的指示并收到 403 Forbidden(尽管我的文件为 775)时,我给他们发了电子邮件,这些是我的回复。
等了 2 天,我收到了回复。
对于给您带来的不便,我们深表歉意。我们已检查您服务器上的文件,并确定 /htdocs/rails/testingApp/public 目录中没有上传索引文件。请将您的索引文件上传到 /public 目录中。
..因为 RoR 现在已经用完了 public 目录?
我友善地向他们解释说,RoR 应用程序不会解析到公共目录。
2 天后..
对于造成的混乱,我深表歉意,我们的 Rails 应用程序部署方式, /public/ 文件夹将是 http://testingapp.yourwebsite.com/ 解析为。如果您的应用程序设置为从另一个文件夹运行其公共根目录,您可能需要更改或重新部署。
这里谁是傻子?我不知道。有没有办法将 RoR 应用程序解析到公共文件夹?
I've been back and forth with Network Solutions for weeks. All they have is an file upload button to upload your application to, and that's it. No way to start up the application, or SSH into the server. When I did follow their directions explicitly, and received a 403 Forbidden even though my files were 775, I emailed them, and these were my responses.
Waiting 2 days, I got this response..
We apologize for the inconvenience. We have checked your files on the server and we have determined that there is no index file uploaded on /htdocs/rails/testingApp/public directory. Please upload your index file inside the /public directory.
..because RoR runs out of the public directory now?
I explained to them, kindly, that RoR apps do not resolve to the public directory.
2 days later..
I apologize for the confusion, the way our rails apps deploy, the /public/ folder will be the default directory that http://testingapp.yourwebsite.com/ resolves to. You may need to alter or redeploy if your applicaton is set to run it's public root from another folder.
Whose dumb here? I can't tell. Is there a way to resolve an RoR app to the public folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
听起来他们正在使用 Phusion Passenger 来为 Rails 应用程序提供服务,其中 DocumentRoot 确实是 Rails /public 子目录。这是 Rails 应用程序的常见托管场景。
Sounds like they are using Phusion Passenger to serve Rails apps, for which the DocumentRoot is indeed the Rails /public subdirectory. This is a common hosting scenario for Rails apps.
你是对的,实际上驻留在网络服务器和 Rails 之间的中间件(我认为是 Rack?)负责将遵循路由文件到达
yourname.com/
的 HTTP 请求转换为正确的控制器,并且配对视图。这意味着您永远不会在公共场合拥有代表页面索引的真实文件。我不明白他们在问什么(因为他们明确声明他们提供 RoR 托管) )。他们的要求似乎只是无能。
公共文件夹用于发布静态资源,但仅用于此目的,以便将每个指向 URL 根目录下的静态源的请求(例如
yoursite.com/static_img.jpg
)转发到真实的资源。文件驻留在该目录中,但对于普通 RoR 视图而言并非如此。You are right, actually the middleware (Rack I think?) that resides between the webserver and Rails takes care to convert an HTTP request that arrives on
yourname.com/
following the routes file to the correct controller and paired view.This means that you won't never have a real file in public which represents the index of your page.. I don't get what they are asking about (since they explicitly state that they offer RoR hosting). Their request seems just incompetency.
The public folder is used to publish static resources but just for that so that every requests that points to a static source under root of the URL, eg
yoursite.com/static_img.jpg
, is forwarded to the real file residing in that directory, this is not true for normal RoR views.我对 webfaction 非常满意,它提供了大致相同的功能、出色的 Rails(甚至 Rails 3)支持、ssh 访问,而且我发现它们非常便宜。
I am really happy with webfaction, which offers about the same functionality, excellent rails (even rails 3) support, ssh access, and i find them really cheap.
我对乘客答案投了赞成票,但我认为您真正的答案可能位于 http://heroku.com/ 中。很可能是我做过的最简单的 Rails 部署之一。
I upvoted the Passenger Answer, but I think your real answer might lie in http://heroku.com/. quite possibly one of the easiest deployments of rails I have ever done.
是否有 .htaccess 文件?您可以为index.html 添加重写规则。
Is there an .htaccess file? You could add a rewrite rule for index.html.