【问题标题】:ASP.NET Core Apache Reverse Proxy for Kestrel用于 Kestrel 的 ASP.NET Core Apache 反向代理
【发布时间】:2017-02-18 05:36:08
【问题描述】:

我想在我的 Ubuntu 服务器上测试“新”ASP.NET Core。我使用 Apache,但官方文档 (https://docs.asp.net/en/latest/publishing/linuxproduction.html) 仅涵盖 Nginx。有人可以帮我将反向代理的 Nginx 配置“翻译”为 Apache VHost 吗?

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

来源:ASP.NET Core 文档(见上文)

对于 SSL:https://docs.asp.net/en/latest/publishing/linuxproduction.html#configure-ssl

【问题讨论】:

  • 我个人并不熟悉 Apache,所以留下评论而不是答案,但这篇文章似乎给了你想要的东西:tattoocoder.com/…

标签: asp.net apache nginx reverse-proxy


【解决方案1】:

自从我提出这个问题以来,(仍然相当新的)ASP.NET Core 的可用文档已经更新。这里有两个文章链接(感谢 David Peden),它们解释了 Apache 所需的配置。即使它们以 CentOS 为目标,在 Ubuntu 上使用它们也没有问题。

【讨论】:

    【解决方案2】:

    您可以使用Proxy library for ASP.NET Core

     app.UseWebSockets()
         .Map("/api", api => api.RunProxy(new Uri("http://localhost:8833")))
         .Map("/image", api => api.RunProxy(new Uri("http://localhost:8844")))
         .Map("/admin", api => api.RunProxy(new Uri("http://localhost:8822")))
         .RunProxy(new Uri("http://localhost:8811"));
    

    查看更多详情here

    【讨论】:

      猜你喜欢
      • 2019-09-04
      • 2020-01-07
      • 2022-12-22
      • 2021-05-25
      • 2016-02-19
      • 2015-06-18
      • 2020-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多