9

I am trying to understand the entire web/framework/application stack when installing ASP.NET 5 on Linux.

All the instructions I have read, including this one haven't really answered my question:

Why can't Nginx server work without Kestrel like here: http://www.mono-project.com/docs/web/fastcgi/nginx/ ?

Or am I way off. I'm trying to understand what the reason is for this structure:

.NET Core(or mono) --> Kestrel --> Nginx

Isn't Kestrel just another web server like Nginx but with a lot less features?

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147
Freeman Helmuth
  • 173
  • 1
  • 16

2 Answers2

8

ASP.NET Core (ASP.Net 5) doesn't require Kestrel!

You're right, Kestrel is just a simple HTTP server with a small set of features. You can run ASP.NET Core without Kestrel on Linux or Mac, but you must either have an HTTP server or a fastCGI server.

Nginx is used as a reverse proxy for static contents in general and you can also enable gzip compression on your dynamic content. Kestrel doesn't have this feature.

You can also write your own HTTP server with the specific HTTP features you need (HTTP2 for example).

agua from mars
  • 16,428
  • 4
  • 61
  • 70
  • So you're saying, if I install ASP.net 5, and used nginx with a fast cgi server I should be all set? – Freeman Helmuth Sep 03 '15 at 12:09
  • 2
    Yes, if you want use `Nginx` to use its features. And your `fastCGI` server must be able to run `ASP.Net 5`. In my opinion it's better to use `Nginx` as a reverse proxy with `Kestrel` or another simple `HTTP server`. I think you can use `Apache` as reverse proxy instead of `Nginx` as well. – agua from mars Sep 03 '15 at 12:30
  • Hi, your link is broken – Pavel Biryukov Jul 27 '16 at 08:14
  • @PavelBiryukov I updated my response because I removed the FastCGI server from my repo and I used Kestrel now; it become realy fast – agua from mars Jul 27 '16 at 08:57
  • So far the theory. But in practise, there is no FastCGI host for ASP.NET Core (yet, to date) - so you are in fact limited to Kestrel... But at least the missing piece of information: When you are using Kestrel, nginx acts as a proxy-server, and kestrel is your server. When you are using a fastcgi-server, nginx acts as server + fastcgi-request-forwarder. – Stefan Steiger Oct 02 '16 at 23:47
  • @Freeman Helmuth: No, what he is in fact saying is, that if there were a fastcgi-server for .NET Core, you would be "all set". What that also means is that .NET Core has been "extensively tested" to make sure it works properly when it is run via FastCGI. Warning: Sarcasm. – Stefan Steiger Oct 02 '16 at 23:52
5

Necromancing.

Yes, it does in fact require Kestrell.
As Agua says, theoretically, it could also be run on some other http-server than Kestrell, one that can run .NET Core, or via FastCGI.

However, AFAIK, Kestrell is the only http-server currently in existance that can actually do that.
And because AFAIK, a FastCGI-server/library written in .NET Core doesn't (yet) exist.

Right now, if you want to use .NET Core with nginx or Apache, all you can do is to reverse-proxy requests to kestrell.

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442