1

Having trouble configuring NGINX to serve JSON from nodejs. Static files are serving fine, but the /API requests are timing out.

NGINX config file

server {
    listen 80;  
    root /home/doctorep/doctoreports;
    #index index.html index.htm;

    server_name doctoreports.com;

    location / {
    proxy_pass      http://127.0.0.1:8080;
    }

    location /api/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect off;
    }
}

I tried every variation of config I could find using google-foo and couldn't get any to work. If I curl the api from the CLI I get the expected json return. So I think the problem is in the NGINX config. Any help or suggestions are appreciated!

3
  • There's a typo on proxy_pass http:127.0.0.1:8080; <-- gotta be http:// Commented Jul 25, 2016 at 5:00
  • Thanks, updated the question, still same problem on the server Commented Jul 25, 2016 at 5:18
  • Solved by figuring out that my CouchDB views were not working because of a dependency conflict Commented Sep 12, 2016 at 16:27

1 Answer 1

1

Sorry for answering my own question...Figured out that CouchDB had a dependency conflict and was not serving views properly. Figured that out by setting up an SSH tunnel and using the /_utils to try and modify and view the /views for my database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.