Enable SSL with ASP.NET Core using Nginx and Docker ... | asp.net core nginx docker
Whendevelopingwebappsandapi’swithASP.NETCore[1],itisusefultoreplicatethekindofsetupusedtodeployyourapplicationtoproduction.Whilethebuilt-inKestrel[2]webserverisadequateforlocaldevelopment,youneedafull-fledgedwebserver,suchasIIS[3],Apache[4]orNginx[5],toperformfunctionssuchasloadbalancing[6]andSSLtermination[7].Therefore,itisworthwhiletoconfigureanASP.NETCoreprojecttorunlocallyusingNginxasareverseproxy[8] forsecurecommunicationoverHTTPS[9].Ofcourse,thebestwaytodothisisbyrunningboththewebappan...
When developing web apps and api’s with ASP.NET Core[1], it is useful to replicate the kind of setup used to deploy your application to production. While the built-in Kestrel[2] web server is adequate for local development, you need a full-fledged web server, such as IIS[3], Apache[4] or Nginx[5], to perform functions such as load balancing[6] and SSL termination[7]. Therefore, it is worthwhile to configure an ASP.NET Core project to run locally using Nginx as a reverse proxy[8] for secure communication over HTTPS[9]. Of course, the best way to do this is by running both the web app and reverse proxy in Docker[10] containers.
You can download the code for this blog post here: https://github.com/tonysneed/Demo.AspNetCore-Nginx-Ssl[11]
Dockerize Web APITo get started you’ll need to install Docker Desktop[12] for Windows or Mac. Then create a Web API project using the .NET Core SDK[13].
Then open the project folder in a code editor of your choice. My favor...