使用 Thin 和 nginx 装载的 Sinatra 应用程序未加载资源
我有一个简单的 Rails 应用程序,其 Resque 服务器安装在 routes.rb
中,作为
require 'resque/server'
require 'resque_scheduler'
MyApp::Application.routes.draw do
authenticate :user do
mount Resque::Server.new, :at => "/tasks"
end
...
...
将应用程序安装在路由中以使用基于设计的身份验证。然而,在生产中,Resque 服务器的资源不会加载,而主 Rails 应用程序的资源会正确加载。
I have a simple Rails app with Resque server mounted in routes.rb
as
require 'resque/server'
require 'resque_scheduler'
MyApp::Application.routes.draw do
authenticate :user do
mount Resque::Server.new, :at => "/tasks"
end
...
...
Mounted the app in routes to use devise based authentication. In production however, the assets are not loaded for the Resque server while the assets for the main Rails app load properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
环顾四周后,这对我来说对 nginx 和 Thin 有用:
路由文件如下所示:
更改
并在 production.rb 中
为第三,在某些情况下,nginx 配置为 Rails,如下所示:
其中 PATH_TO_APP 是应用程序根目录的路径。此类位置声明可防止从任何其他位置加载已安装的 rake 应用程序或引擎的资产。因此,需要将其删除/注释掉。
最后,不要忘记使用
Ctrl+F5
强制重新加载页面:)After looking around this worked for me with nginx and thin:
The routes file look as follows:
and changing
in production.rb to
Thirdly, in some cases nginx is configured for rails as follows:
Where PATH_TO_APP is the path of the application root directory. Such location declaration prevents assets to be loaded from any other location for a mounted rake app or engine. This therefore, needs to be removed/commented out.
Lastly, don't forget to do a
Ctrl+F5
to force reload the page :)