I'm not familiar with nginx, but it might help if you posted your nginx
configuration for CouchDB. There's also an example on the wiki which might
help: http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy
Nils.
Alasdair Macmillan wrote:
> Hi
>
> I've had no bother running couchdb on my mac. But going into production now I
> have installed 1.01 on my webfaction hosted linux install. Now I know that
> they use nginx as a proxy in front of apache and advise that you set up an
> 'app' (in webfaction speak) running at a custom port and then run couchdb at
> that same port and it all works in the sense thatCouchdb runs from the
> command line and futon runs too although sluggishly I feel.
>
> However, something is badly wrong when I run the test suite:
>
> basics, all_docs, attachments, compact, config, conflicts, delayed_commits,
> design_docs, design_options, etags_head, oauth, reader_acl, recreate_doc,
> reduce, replication, show_documents, stats, update_documents, users_db, utf8
> all show errors (although which ones fail seems to vary sometimes
> attachment_multipart fails)
>
> All the errors seem to be 502 gateway related:
>
> all the errors are:
>
> Exception raised: {"error":"unknown","reason":"\u000d\u000a502 Bad
> Gateway\u000d\u000a\u000d\u000a<h1>502 Bad Gateway\u000d\u000a
>
> nginx\u000d\u000a\u000d\u000a\u000d\u000a"}
> except for 'compact; which also has:
>
> Assertion failed: xhr.responseText == "This is a base64 encoded text"
> Assertion failed: xhr.getResponseHeader("Content-Type") == "text/plain"
>
> One Webfaction support person said:
>
> "A "502" error simply means that Nginx fdid not receive a proper HTTP
> response from the application that it is proxying HTTP requests to (i.e. your
> CouchDB instance). So, it is unlikely that this is somehting specific to
> Nginx - it simply passes the request on and expects a proper HTTP response.
> Most likely there is some misconfiguraiton on the HTTP side of your CouchDB
> application. I would suggest that you verify that the HTTP server of CouchDB
> is actually running on the port assigned to your "Custom app listening on
> port", and that you check the appropriate logs of CouchDB for more
> information about what went wrong with the hTTP request."
>
> but another said:
>
> "Looking at your account, it appears that your couchdb instance is running
> normally.
>
> The error you are receiving does not appear to be caused by couchdb; rather,
> 502 errors in general suggest that the back-end webserver (behind Nginx) is
> timing out and not responding to requests. Database connection issues and
> other application errors usually respond with 500 errors instead. To solve a
> 502 error, follow the incoming requests and ensure that Nginx is forwarding
> them to web applications which are active and listening on the appropriate
> port.
>
> So they don't seem to have a clue what is going on. I am trying to work out
> how this all works. Can anybody help me understand what is broken and where.
> I have attached the logs I have access to and they are here:
> http://idisk.mac.com/al.macmillan//Public/couch.log.txt
> http://idisk.mac.com/al.macmillan//Public/http_log.txt
>
> I'm checking with webfaction if I can see the nginx logs.
>
> Kind thanks
> AL