nginx 无法连接到 kestrel
nginx cannot connect to kestrel
我在 Ubuntu 服务器上使用 DNX 4.5.1 和 RC1 更新 1 运行时。我的后端应用程序运行在 Kestrel 上,监听 localhost:5004。我的前端是 nginx,它将请求重定向到后端。但是由于某些原因 nginx 无法连接到 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"
我的应用程序已启动 运行:
arnaud@ubuntu:/var/log/nginx$ sudo netstat -tap | grep单声道
tcp 0 0 localhost:5004 *:* LISTEN 2389/mono<br>
tcp 0 0 localhost:48663 localhost:mysql 已建立 2389/mono
(第二行是我连接数据库的应用)
我在 project.json 文件中尝试了服务器的各种选项。我试图让 Kestrel 监听 http://*:5004
、http://localhost:5004
和 http://127.0.0.1:5004
。 None 似乎有效。在我的 nginx 配置中,我也尝试了不同的后端地址(localhost 和 127.0.0.1),但都没有成功。这是我为此应用程序的 nginx 配置:
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 是 Ubuntu 15.04 上的 1.6.2 版。我不确定出了什么问题,如有任何帮助,我们将不胜感激!
好吧,显然我在发布问题之前没有认真看,因为那里已经有人问过了:ASP.NET 5 behind nginx
Kestrel 中似乎存在错误,您需要在 nginx 配置中启用 Keep-Alive headers 才能使其正常工作。
我在 Ubuntu 服务器上使用 DNX 4.5.1 和 RC1 更新 1 运行时。我的后端应用程序运行在 Kestrel 上,监听 localhost:5004。我的前端是 nginx,它将请求重定向到后端。但是由于某些原因 nginx 无法连接到 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"
我的应用程序已启动 运行:
arnaud@ubuntu:/var/log/nginx$ sudo netstat -tap | grep单声道
tcp 0 0 localhost:5004 *:* LISTEN 2389/mono<br>
tcp 0 0 localhost:48663 localhost:mysql 已建立 2389/mono
(第二行是我连接数据库的应用)
我在 project.json 文件中尝试了服务器的各种选项。我试图让 Kestrel 监听 http://*:5004
、http://localhost:5004
和 http://127.0.0.1:5004
。 None 似乎有效。在我的 nginx 配置中,我也尝试了不同的后端地址(localhost 和 127.0.0.1),但都没有成功。这是我为此应用程序的 nginx 配置:
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 是 Ubuntu 15.04 上的 1.6.2 版。我不确定出了什么问题,如有任何帮助,我们将不胜感激!
好吧,显然我在发布问题之前没有认真看,因为那里已经有人问过了:ASP.NET 5 behind nginx
Kestrel 中似乎存在错误,您需要在 nginx 配置中启用 Keep-Alive headers 才能使其正常工作。