简体   繁体   English

用于 Kestrel 的 ASP.NET Core Apache 反向代理

[英]ASP.NET Core Apache Reverse Proxy for Kestrel

I want to test the "new" ASP.NET Core on my Ubuntu server.我想在我的 Ubuntu 服务器上测试“新的”ASP.NET Core。 I use Apache, but the official documentation ( https://docs.asp.net/en/latest/publishing/linuxproduction.html ) only covers Nginx.我使用 Apache,但官方文档 ( https://docs.asp.net/en/latest/publishing/linuxproduction.html ) 仅涵盖 Nginx。 Can somebody help me to "translate" the Nginx configuration for the reverse proxy to an Apache VHost?有人可以帮我将反向代理的 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; } }

Source: ASP.NET Core Documentation (see above)来源:ASP.NET Core 文档(见上文)

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

You can use Proxy library for ASP.NET Core您可以为 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"));

Check for more detail here .在此处查看更多详细信息

The available documentation for the (still rather new) ASP.NET Core have been updated since I've asked this question.自从我提出这个问题以来,(仍然是新的)ASP.NET Core 的可用文档已经更新。 Here a two links to articles (thanks to David Peden) that explain the needed configuration for Apache.这里有两个指向文章的链接(感谢 David Peden),这些文章解释了 Apache 所需的配置。 Even though they target CentOS, it is no problem to use them for Ubuntu.即使它们针对 CentOS,将它们用于 Ubuntu 也没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM