AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-6617

kolrie's questions

Martin Hope
kolrie
Asked: 2017-04-01 18:57:56 +0800 CST

Ubuntu 16.04 上的 Nginx + Docker + DotNet 应用程序请求超时

  • 0

我在 Digital Ocean 上有一个带有 Docker 的 Ubuntu 16.04 环境,我正在使用 docker-compose 启动一个服务:

version: '2'
services:
  cis-api:
    image: docker.myserver.com/cis-api:latest
    ports:
      - 8080:5000
    environment:
      DB_CONN_STRING: 'Server=tcp:...;Initial Catalog=cis-stage;Persist Security Info=False;User ID=...;Password=...;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;'

然后我安装了香草 Nginx,里面有一个配置/etc/nginx/conf.d:

upstream cis-api {
  server 0.0.0.0:8080;
}

server {
  listen 80;
  server_name cis-api.myserver.com;

  location / {
    proxy_pass                          http://cis-api;
    proxy_set_header  Host              $http_host;   # required for docker client's sake
    proxy_set_header  X-Real-IP         $remote_addr; # pass on real client's IP
    proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_read_timeout                  900;
  }
}

当我尝试绕过 nginx 请求 URL 时,一切正常:

root@cis-stage:/etc/nginx# curl localhost:8080/businesses -H 'Authorization: Bearer ...'
[{"id":1,...,"email":null}]

但是,如果我尝试通过 nginx 执行完全相同的请求,则连接会挂起,或者如果我设置了 30 秒超时,则会超时:

root@cis-stage:/etc/nginx# curl --max-time 30 --connect-timeout 30 http://cis-api.mysever.com/businesses -H 'Authorization: Bearer ....'

curl: (28) Operation timed out after 30000 milliseconds with 0 bytes received

该应用程序是用 ASP.Net Core 1.1 编写的,这是我绕过 nginx 运行它时的输出差异:

cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[1]
cis-api_1  |       Connection id "0HL3OL7D1CF19" started.
cis-api_1  | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
cis-api_1  |       Request starting HTTP/1.1 GET http://localhost:8080/businesses
cis-api_1  | info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[2]
cis-api_1  |       Successfully validated the token.
cis-api_1  | info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[3]
cis-api_1  |       HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer.
cis-api_1  | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
cis-api_1  |       Request finished in 414.6261ms 200 application/json; charset=utf-8
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[6]
cis-api_1  |       Connection id "0HL3OL7D1CF19" received FIN.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[9]
cis-api_1  |       Connection id "0HL3OL7D1CF19" completed keep alive response.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[10]
cis-api_1  |       Connection id "0HL3OL7D1CF19" disconnecting.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[7]
cis-api_1  |       Connection id "0HL3OL7D1CF19" sending FIN.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[8]
cis-api_1  |       Connection id "0HL3OL7D1CF19" sent FIN with status "0".
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[2]
cis-api_1  |       Connection id "0HL3OL7D1CF19" stopped.

当我使用 nginx 作为代理运行时:

cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[1]
cis-api_1  |       Connection id "0HL3OL7D1CF1B" started.
cis-api_1  | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
cis-api_1  |       Request starting HTTP/1.0 GET http://cis-api.myserver.com/businesses
cis-api_1  | info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[2]
cis-api_1  |       Successfully validated the token.
cis-api_1  | info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerMiddleware[3]
cis-api_1  |       HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer.

它挂在这里直到请求超时,然后:

cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[6]
cis-api_1  |       Connection id "0HL3OLAD6F4QN" received FIN.
cis-api_1  | info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
cis-api_1  |       Request finished in 4615.4522ms 200 application/json; charset=utf-8
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[10]
cis-api_1  |       Connection id "0HL3OLAD6F4QN" disconnecting.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[7]
cis-api_1  |       Connection id "0HL3OLAD6F4QN" sending FIN.
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[8]
cis-api_1  |       Connection id "0HL3OLAD6F4QN" sent FIN with status "-107".
cis-api_1  | dbug: Microsoft.AspNetCore.Server.Kestrel[2]
cis-api_1  |       Connection id "0HL3OLAD6F4QN" stopped.

有任何想法吗?

nginx
  • 1 个回答
  • 1963 Views
Martin Hope
kolrie
Asked: 2012-08-20 09:45:33 +0800 CST

具有私有 IP 的 Xen DomU

  • 1

我有一台在 eth0 和路由网络配置中具有公共 IP 的服务器。

我创建了具有私有 IP (10.0.1.x) 的 DomU,它们可以 ping Dom0 和其他私有 IP,但我希望它们能够 ping 外部世界。

我怎样才能做到这一点?

linux
  • 1 个回答
  • 110 Views
Martin Hope
kolrie
Asked: 2012-05-12 11:25:59 +0800 CST

使用第三台服务器将文件从一台服务器传输到另一台服务器的最佳方法

  • 5

这是场景:

                   ssh  +------------+
                  +---->|  Server 2  |
 +------------+   |     +------------+
 |  Server 1  +---+
 +------------+   |     +------------+
                  +---->|  Server 3  |
                   ssh  +------------+

我有从和(但不是从Server 1到,也不是相反)的 SSH 访问权限。Server 2Server 3Server 2Server 3

我想将一个相当大的文件从 传输2到3并且想知道通过1充当协调器来最快的方法是什么。

更新:我确实在两台服务器之间建立了连接,只是没有来自/到服务器的 SSH 凭据。

ssh copy
  • 2 个回答
  • 1309 Views
Martin Hope
kolrie
Asked: 2009-08-20 19:59:47 +0800 CST

服务器端编辑的 Vim 配置

  • 1

我总是在我们的服务器上使用 Vim(主要是基于 Ubuntu),而且我总是缺乏一个适合通过 SSH 的 vim 而没有太多装饰的好配置。

我想为那些主要在服务器上直接编写 bash、zsh 和 ruby​​ 代码的人收集尽可能多的配置设置。

vim vimrc
  • 5 个回答
  • 1120 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve