通过 Nginx 获取上传过程 +独角兽

发布于 2024-11-15 03:40:43 字数 478 浏览 8 评论 0原文

我正在使用 Nginx 为我拥有的 Rails 应用程序反向代理我的 Unicorn 进程。我希望能够获得进度状态(类似于 apache-upload-progress-module )用于文件上传。我尝试使用 NginxHttpUploadProgressModule 但 /progress 仍然路由到 Rails 应用程序,因此不起作用。我按照 NginxHttpUploadProgressModule 中的步骤操作,所以我真的到了这里。

I'm using Nginx to reverse proxy my Unicorn process for a Rails app that I have. I would like to be able to get a progress status (similar to apache-upload-progress-module) for file uploads. I tried to use NginxHttpUploadProgressModule but /progress still routes to the Rails app so that doesn't work. I followed the steps in NginxHttpUploadProgressModule so I'm really at a stopping point here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喜爱皱眉﹌ 2024-11-22 03:40:43

如果没有看到您实现的确切配置,也没有看到调试日志,就很难理解可能出了什么问题。

我建议您:

  1. 使用 --with-debug 选项编译 nginx,并使用 error_log 指令激活调试日志。
  2. 检查 /progress 请求的调试日志并查看测试位置的顺序。

您很可能正在使用 try_files 并且您的 /progress 位置不会触发,因为它位于您的 catch all 位置之后。您可以尝试将 /progress 位置放在服务器 {} 指令的顶部

Without seeing the exact configuration you implemented, nor debug log, it is difficult to understand what can be wrong.

I suggest you:

  1. compile nginx with the --with-debug option and activate debug log with the error_log directive.
  2. check the debug log for the /progress request and look the order of the tested locations.

It is well possible you are using try_files and your /progress location doesn't trigger because it is located after your catch all location. You can try to put the /progress location at the top of your server {} directive

榕城若虚 2024-11-22 03:40:43

我正在使用它,

location ^~ /progress {
  upload_progress_json_output;
  report_uploads proxied;
}

在服务器块中有一个部分,它工作正常,Rails 从未看到 /progress

I am using it, have a

location ^~ /progress {
  upload_progress_json_output;
  report_uploads proxied;
}

section in the server block and it works fine, Rails never sees /progress.

撕心裂肺的伤痛 2024-11-22 03:40:43

好吧,我在你们(masterzen 和 jl)的帮助下解决了这个问题。我没有

location ^~ /progress {
  upload_progress_json_output;
  report_uploads proxied;
}

,但是

location ^~ /progress {
  report_uploads proxied;
}

masterzen 的评论也像我

location / {
  # blah blah
}

在 /progress 之前所做的那样有帮助。非常感谢你们!

Alright so, I figured it out with the help of both you guys (masterzen, and j-l). I didn't have

location ^~ /progress {
  upload_progress_json_output;
  report_uploads proxied;
}

but

location ^~ /progress {
  report_uploads proxied;
}

and masterzen's comment helped also as I had

location / {
  # blah blah
}

before the /progress. Thank you so much guys!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文