I'm using (ASP).NET Core (3.1x), C#, Blazor and Microsoft Kestrel Web-server and I'm wondering if I can run 2 or 3 different websites (domain names) on one Kestrel instance and on port 80. I would really like to use Kestrel as the only web server and not use a proxy server like nginx in front of it.
I've been googling for an answer for a while now but I can't find an answer to this question. I'm renting colocation server space where I run an Ubuntu 18.04 VPS, and I would really like to run multiple websites on this one VPS, instead of renting multiple VPS's. I am thinking about some sort of routing but I can't figure it out.
Is there any way to use Kestrel and run different websites on port 80?
Update - feb 25th 2020
I've created a Github issue about this, long story short: Use a reverse proxy server like Nginx (for Linux). Only one Kestrel process can run on port 80, and there no good way to host multiple websites with one instance.
Update - May 4th 2021
It is now possible with Microsoft's reverse proxy "YARP", which is a separate Kestrel instance. See my answer below.
To run multiple domains on one server on port 80 and/or 443 with Kestrel you'll need to put a reverse proxy in front of it.
Microsoft has now its own really fast reverse proxy called YARP which is actually another Kestrel instance, see: Getting Started With Yarp
To use it with TLS/HTTPS you'll need Kestrel's SNI feature, see this GitHub discussion for more info
Here's a sample appsettings.Development.json
GIST how I did it.