2016-04-01 14 views

Antwort

1

Proxy in nginx umzukehren, müssen Sie eine Config, die für Ihre couchdb ähnliche https://www.nginx.com/resources/admin-guide/reverse-proxy/

upstream mycouch { 
    server 192.168.0.100: 
} 

server { 
    listen  *:80; 
    server_name mycouch.mydomain.whatever.com; 
    underscores_in_headers on; 

    location/{ 
    expires off; 
    proxy_pass http://mycouch; 
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 
    proxy_redirect off; 
    proxy_buffering off; 
    proxy_set_header  Host   $host; 
    proxy_set_header  X-Real-IP  $remote_addr; 
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for; 
    } 
} 

Dies wird Proxy-HTTP-Aufrufe aussieht. Da du diese Frage mit docker getaggt hast, würde ich vorschlagen, dass du FROM nginx, https://hub.docker.com/_/nginx/ startest (oder einfach eine Konfigurationsdatei in nginx image einbindet)

+0

bitte, was soll ich ändern –

1

ich benutze diese config und es funktioniert für mich

... 
 
location/{ 
 
    proxy_pass http://192.168.99.100:5984 //couchdb address 
 
    proxy_redirect off; 
 
    proxy_set_header Host $host; 
 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
 
    } 
 
    
 
    location ~ ^/(.*)/_changes { 
 
    proxy_pass http://192.168.99.100:5984 //couchdb address 
 
    proxy_redirect off; 
 
    proxy_buffering off; 
 
    proxy_set_header Host $host; 
 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
 
    } 
 
...

+1

Idk, warum Sie die 2 Standorte, sieht bräuchten wie sie das gleiche Backend sind Proxying, aber froh, dass es funktioniert! – djcrabhat

+0

Ich brauche den zweiten Ort 'location ~ ^/(. *)/_ Changes {...}' um die CouchDB-Replikation zu aktivieren –