2015-02-04 5 views
2

내 루트 서버에 couchdb를 설치했습니다. 이제는 PUT 요청을 프록시를 통해 데이터베이스에 허용하려고합니다. 그러나 나는 그것을 작동시킬 수 없다. 내가 시도하는 것 :CouchDB 역 프록시

(.htaccess) 
SetEnvIf Request_URI acraproxy acraproxy 
RequestHeader set Authorization "Basic base64credentials" env=acraproxy 
RewriteEngine On 
RewriteRule ^acraproxy/(.*)$ http://localhost:5984/mydatabase/_design/acra-storage/_update/report/$1 [P] 

나는 항상 내가이 같은 PHP 스크립트를 사용하려고 405 오류 코드 수 :

<?php 
$COUCH_INSTANCE = 'http://www.acmecouch.com'; // URL of your CouchDB instance 
$COUCH_PORT = 80; // Port of your CouchDB instance 
$REPORTER_USER = 'acra'; // Username of the reporter user 
$REPORTER_PASSWORD = 'r3p0rts'; // Password for the reporter user 
$APPNAME = 'myapp'; // the name of your app, same as defined when pushing your own acra-storage couchapp instance 

if($_SERVER['REQUEST_METHOD'] === 'PUT') { 
    $curl = curl_init($COUCH_INSTANCE.'/acra-'.$APPNAME.'/_design/acra-storage/_update/report/'.$_GET["reportid"]); 
    curl_setopt($curl, CURLOPT_PORT, $COUCH_PORT); 
    curl_setopt($curl, CURLOPT_USERPWD, $REPORTER_USER . ":" . $REPORTER_PASSWORD); 
    curl_setopt($curl, CURLOPT_FAILONERROR, true); 
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($curl, CURLOPT_PUT, true); 
    curl_setopt($curl, CURLOPT_INFILE, fopen("php://input","r")); 
    curl_setopt($curl, CURLOPT_INFILESIZE, $_SERVER['CONTENT_LENGTH']); 
    $result = curl_exec($curl); 
    echo $result; 
} else { 
    // If not a PUT request, just get the root of the CouchDB. 
    // This allows to check with a browser that the path from your php server 
    // to the couch instance is operational. 
    $curl = curl_init($COUCH_INSTANCE); 
    curl_setopt($curl, CURLOPT_FAILONERROR, true); 
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    $result = curl_exec($curl); 
    echo $result; 
} 
?> 

을하지만 그건 PHP 오류와 함께 실패합니다

CURLOPT_FOLLOWLOCATION 
cannot be activated when an open_basedir is set 

이 자습서를 따라했습니다. https://github.com/ACRA/acralyzer/wiki/Setting-up-a-reverse-proxy

누군가 나를 도와 줄 수 있습니까?

답변

0

좋아요. 문제가 직접 발견되었습니다. 아파치 모듈이 누락되었습니다 (서브 모듈 프록시). 이제 위의 솔루션은 완벽하게 작동합니다.

+0

나는 우분투와 아파치 2.2 -> 2.4를 업그레이드 한 후에 같은 상황에 처해있다. 어떤 하위 모듈이 빠졌는지 기억하십니까? –

관련 문제