I'm using DNX 4.5.1 with the RC1 update 1 runtime on an Ubuntu Server. My backend application runs over Kestrel, listening on localhost:5004. My front-end is nginx which redirects the requests to the backend. However for some reason nginx is not able to connect to Kestrel:
2015/12/07 15:31:44 [error] 2263#0: *7 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.33.1, server: ribandelle.lan, request: "GET /api/track/2 HTTP/1.1", upstream: "http://127.0.0.1:5004/api/track/2", host: "ribandelle.lan"
My application is up and running:
arnaud@ubuntu:/var/log/nginx$ sudo netstat -tap | grep mono
tcp 0 0 localhost:5004 *:* LISTEN 2389/mono
tcp 0 0 localhost:48663 localhost:mysql ESTABLISHED 2389/mono
(the second line is my application connecting to the database).
I have tried various options for the server in the project.json file. I tried to have Kestrel listen on http://*:5004
, http://localhost:5004
and http://127.0.0.1:5004
. None seem to work. In my nginx configuration I also have tried different addresses for the backend (localhost and 127.0.0.1) also with no success. This is my nginx configuration for this application:
upstream backend {
server 127.0.0.1:5004;
}
limit_req_zone $binary_remote_addr zone=api:10m rate=5r/s;
server {
listen 80;
server_name ribandelle.lan;
location / {
limit_req zone=api burst=15;
proxy_pass http://backend;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
nginx is version 1.6.2 on Ubuntu 15.04. I'm not sure what's wrong and any help would be appreciated!