【问题标题】:Running Nginx proxy for Kestrel AspNet5为 Kestrel AspNet5 运行 Nginx 代理
【发布时间】:2016-02-16 15:04:55
【问题描述】:

我在运行 Nginx 服务器以代理对 Kestrel 的请求时遇到了一些问题。在 Kestrel 中,我可以看到响应速度相对较快,由于某种原因导致 Nginx 崩溃,直到超时才返回响应。

这是我的代理配置:

server {
 listen   80;
 server_name    192.168.163.143;
 access_log     /var/log/nginx/mydomain.access.log;
 location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;
        proxy_pass      http://127.0.0.1:5000;
 }
}

ngic.conf:

worker_processes 1;
events{
worker_connections 768;
}

我使用默认参数运行 kestrel 以在端口 5000 上运行应用程序。

在 192.168.163.143 处从浏览器请求它不会返回 json,直到超时。

我试过 curl 我的端点,我发现的是: 直接 Kestrel 调用一次返回整批数据,而 Nginx 调用返回一部分 json 并卡住...

有什么想法吗?

【问题讨论】:

    标签: curl nginx asp.net-web-api proxy kestrel-http-server


    【解决方案1】:

    好的,解决方案很简单。 Kestrel 的 RC1 不适用于关闭的连接,因此您必须保持连接。

    在你的代理配置的位置部分,添加proxy_set_header Connection ""

    【讨论】:

      猜你喜欢
      • 2019-09-04
      • 2016-11-16
      • 1970-01-01
      • 1970-01-01
      • 2017-08-09
      • 2015-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多