簡體   English   中英

nginx無法連接到紅est

[英]nginx cannot connect to kestrel

我在Ubuntu Server上將DNX 4.5.1與RC1 update 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 mono tcp 0 0 localhost:5004 *:* LISTEN 2389/mono
tcp 0 0 localhost:48663 localhost:mysql ESTABLISHED 2389/mono

(第二行是我的應用程序連接到數據庫)。

我在project.json文件中嘗試了服務器的各種選項。 我試圖讓Kestrel監聽http://*:5004http://localhost:5004http://127.0.0.1:5004 似乎沒有任何工作。 在我的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版本。 我不確定發生了什么問題,我們將不勝感激!

顯然,在發布問題之前,我看起來不夠努力,因為已經有人問過問題: nginx背后的ASP.NET 5

似乎Kestrel中存在一個錯誤,您需要在nginx配置中啟用Keep-Alive標頭才能使其正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM