2012-07-10 2 views
3

파일을 찾을 수 없습니다와 나는 같은 것을 가지고 mod_xsendfile 를 설치 한 :X-sendfile을 오류가 나는 아파치 웹 서버를 사용하고

   header('Content-type: application/zip'); 
       header('Content-Disposition: attachment; filename="file.zip"'); 
       //header("X-Accel-Redirect: /file/protected/file.zip"); //for nginx server 
       header('X-Sendfile: /protected/file.zip'); 
       exit(); 

내가 /etc/apache2/apache2.conf에서 사용 가능 :

을 내가 /file/index.php에서 다운로드 버튼을 클릭하면 그가에 위치한 index.php를
XSendFile on 

하면은, 나에게 오류를 제공 내가 처음에 header('X-Sendfile: /file/protected/file.zip'); 이동 시도

를 찾을 수 없음/파일/장소 만은 동일합니다 ..

파일은 몇 KB있다

내가 header("X-Accel-Redirect: /file/protected/file.zip");를 사용하는 경우 그것은 작동하지만 아파치 서버에 대한 어쨌든 그것의, 나에게 빈 .zip 파일을 제공

..

누구나 알고있는 방법 고쳐?

편집 : 그것은하는 error.log 말한다 : xsendfile : 파일을 찾을 수 없습니다 :

/protected/file.zip을 내가 XSendFilePath/보호와 에로를 설정 주어진 경로가 루트 경로 위에 있었다 지금 : (2)No such a file or directory: xsendfile cannot open file: /protected/file.zip,referer: http://domain.com/file/

답변

2

mod xsendfile 설명서를 찾으십시오. 파일을 제공 할 수있는 디렉토리를 설정해야합니다. 만약 당신이 그 일을했다면, 나는 symlinks가 제공되지 않는 등의 다른 문제를 의심 할 것이다 ....

+0

이 디렉토리들을/파일/폴더 안의 .htaccess 파일에 apache2로 설정해야만 하는가? conf 또는 /sites-available/domain.com에 있습니까? – takeit

+1

문서 (https://tn123.org/mod_xsendfile/)에 따르면 XSendFilePath/abs/path 은 apache2.conf 수준 또는 .htaccess 파일에서 작동해야합니다 (허용 우선 적용이 설정된 경우). – Robert

+0

감사합니다 작동 :) – takeit

관련 문제