ASP.NET Kestrel 的核心 Apache 反向代理

ASP.NET Core Apache Reverse Proxy for Kestrel

我想在我的 Ubuntu 服务器上测试 "new" ASP.NET 核心。我使用 Apache,但官方文档 (https://docs.asp.net/en/latest/publishing/linuxproduction.html) 仅涵盖 Nginx。有人可以帮我 "translate" 反向代理到 Apache VHost 的 Nginx 配置吗?

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;
    }
}

Source: ASP.NET Core Documentation (see above)

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

(仍然相当新)ASP.NET 核心的可用文档在我提出这个问题后已经更新。这里有两个文章链接(感谢 David Peden)解释了 Apache 所需的配置。即使他们针对 CentOS,将它们用于 Ubuntu.

也没有问题

您可以使用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"));

查看更多详细信息