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!
proxy_pass http:127.0.0.1:8080;<-- gotta be http://