Capistrano酒店和XSendFile配置 [英] Capistrano and XSendFile configuration

查看:302
本文介绍了Capistrano酒店和XSendFile配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置Rails的生产服务器与Apache 2.2,乘客4.0.59和XSendFile 0.12。应用程序通过部署Capistrano的

I am trying to configure Rails production server with Apache 2.2, Passenger 4.0.59 and XSendFile 0.12. Application is deployed via Capistrano.

部署的应用程序产生(可能大)的PDF #{} Rails.root的/ tmp 和使用提供该文件由send_file

Deployed application produces (maybe large) PDF to #{Rails.root}/tmp and serves this file using send_file.

问题是Capistrano的使用符号链接指向当前部署的应用程序版本。 XSendFile,另一方面取消引用符号链接,并拒绝服务一个文件,如果它真正的位置,即使它是由 XSendFilePath 允许境外文档根目录。 Apache的error.log中的状态:

The problem is that Capistrano uses symlinks to point to currently deployed version of application. XSendFile on the other hand dereferences symlinks and refuses to serve a file if its real location is outside document root even if it is allowed by XSendFilePath. Apache's error.log states:

(20023)The given path was above the root path: xsendfile: unable to find file: /resolved/path/to/file.pdf

一切都工作得很好,当我设置 PassengerAppRoot XSendFilePath 来的应用程序的当前版本的实际位置,没有符号链接在路径上。但它的确定,直到下一次部署,这需要Apache重新配置。不是很有用。

Everything works well when I set PassengerAppRoot and XSendFilePath to the real location of current version of application, without symlinks on the path. But it's OK until next deploy, which requires apache reconfiguration. Not very useful.

如何配置Capistrano的部署和XSendFile参数,使其协同工作?

How should I configure Capistrano deploy and XSendFile parameters to make it work together?

我试着用 LN -nFs 描述的解决方案&安培;的X SENDFILE 并在 mod_xsendfile与但没有工作的符号链接。

I tried solutions with ln -nFs described in Capistrano & X-Sendfile and in mod_xsendfile with symbolic links but none works.

推荐答案

我终于设法使其工作。对于个位数的一些技巧谁将会有XSendFile问题

I finally managed to make it work. A few tips for the ones who will have problems with XSendFile


  1. 我设置 XSendFilePath 用户的 $ HOME ,还有的道路上没有任何符号链接 $ HOME ,所以它的工作原理。我可以从查看的功能和安全的角度接受这一点,但它显然是一个解决办法。

  2. 请注意, XSendFilePath 是包含多个斜线路径很敏感/像这样// 。我使用的Apache宏和,同时从几个宏观参数串联 XSendFilePath 参数我把一些过时的斜线。这引起XSendFile拒绝发送文件。

  1. I set XSendFilePath to user's $HOME, there are no symlinks on the path to $HOME, so it works. I can accept this from functional and security point of view, but it is obviously a workaround.
  2. Be aware that XSendFilePath is sensitive to paths containing multiple slashes /like//this. I am using apache macros and while concatenatingXSendFilePath parameter from a few macro parameters I put some obsolete slashes. This caused XSendFile to refuse to send files.

祝你好运!

这篇关于Capistrano酒店和XSendFile配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆