2012-07-10 5 views
2

nginx를 사용하여 포트 80에서 couchdb를 제공하고 싶습니다. 기본적으로 nginx conf 파일을 다음과 같이 설정합니다.nginx proxy_pass 및 couchdb와 관련된 문제

upstream couchdb { 
    server 127.0.0.1:5984; 
} 

server { 
    listen 0.0.0.0:80; 
    server_name example.com; 
    access_log /path/to/log/couchdb.log; 

    location/{ 
     add_header 'Access-Control-Allow-Origin' '*'; 
     proxy_pass http://couchdb; 
     proxy_set_header Host $host; 
     proxy_redirect off; 
    } 
} 

구성은 특별한 경우를 제외하고는 작동하는 것 같습니다. http://example.com/_utils/을 입력하면 couchdb 인스턴스에 연결되지만 으로 리디렉션되기 때문에 http://example.com/_utils (슬래시가없는 노트)을 입력하면 아무 것도 표시되지 않습니다. http://example.com:5984/_utils/http://example.com:5984/_utils 모두 정상적으로 작동합니다.

내 WAG는 nginx 구성과 관련된 문제이지만 그 방법이 확실하지 않습니다.

답변

2

범인은 proxy_redirect off; 인 것 같습니다. 왜 네가 꺼 버렸어?

+0

감사합니다. 그것은 CORS 작업을 허용하기 위해 필요한 것이라고 생각했습니다. – ebadedude

+0

아니요, 실제로는 매우 유용한 것입니다. 참조 : http://nginx.org/r/proxy_redirect – VBart