{"id":22318001,"url":"https://github.com/adampaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux","last_synced_at":"2025-08-13T19:13:29.731Z","repository":{"id":69583473,"uuid":"154736700","full_name":"AdamPaternostro/Azure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux","owner":"AdamPaternostro","description":"Dotnet Core MVC web app running on Linux using Docker and nginx as a reverse proxy","archived":false,"fork":false,"pushed_at":"2018-10-25T21:41:45.000Z","size":582,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T12:33:03.377Z","etag":null,"topics":["azure","azure-web-app-service","dockerfile","dotnet-core","nginx","nginx-proxy"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdamPaternostro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-25T20:57:58.000Z","updated_at":"2023-08-29T11:02:37.000Z","dependencies_parsed_at":"2023-07-16T15:46:31.563Z","dependency_job_id":null,"html_url":"https://github.com/AdamPaternostro/Azure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AdamPaternostro/Azure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamPaternostro%2FAzure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamPaternostro%2FAzure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamPaternostro%2FAzure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamPaternostro%2FAzure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdamPaternostro","download_url":"https://codeload.github.com/AdamPaternostro/Azure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamPaternostro%2FAzure-Web-App-Nginx-Reverse-Proxy-Dotnet-Core-Linux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267686337,"owners_count":24127715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-web-app-service","dockerfile","dotnet-core","nginx","nginx-proxy"],"created_at":"2024-12-03T23:12:01.307Z","updated_at":"2025-07-29T12:31:05.344Z","avatar_url":"https://github.com/AdamPaternostro.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## How to use nginx as a reverse proxy in a linux docker image hosting a dotnet asp core web app\nThis is some sample code to create a dotnet core web app, install nginx, configure nginx as a reverse proxy and provide a warmup script so the container is not added to the Azure web app load balancer until the application is warmed up.  This application will not have a long warm up since it is just a sample.  To understand Azure and site warm-ups please read reference this: https://github.com/AdamPaternostro/Azure-Tomcat-Web-App-Container\n\n![alt tag](https://raw.githubusercontent.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/master/nginx-reverse-proxy.png)\n\n### How to run this sample\n```\nSoftware:             Install Docker\nSoftware:             Install .NET Core 2.1.5\nCreate directory:     mkdir azure-web-app-nginx-reverse-proxy-dotnet-core-linux\nChange directory:     cd azure-web-app-nginx-reverse-proxy-dotnet-core-linux\nCreate directory:     mkdir nginxproxy\nChange directory:     cd nginxproxy\nCreate .NET code:     dotnet new mvc\nRestore Packages:     dotnet restore\nChange file:          Add .UseUrls(\"http://*:5000/\") to the Program.cs\n                      WebHost.CreateDefaultBuilder(args)\n                        .UseUrls(\"http://*:5000/\")\n                        .UseStartup\u003cStartup\u003e();\nBuild:                dotnet build\nRun locally:          dotnet run\n                      Open a browser and view: http://localhost:5000/\n                      Ctrl+C to quit the dotnet run\nPublish locally:      dotnet publish  \nChange directory:     cd ..\nDownload Files:       By hand or wget these 3 files (Dockerfile, start-server.sh, azurewebsites.net)\n                      wget https://raw.githubusercontent.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/master/Dockerfile\n                      wget https://raw.githubusercontent.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/master/start-server.sh\n                      wget https://raw.githubusercontent.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/master/azurewebsites.net\nBuild Image:          docker build -t nginxreverseproxydotnetcorelinux .\nRun Image Locally:    docker run --rm -it -p 80:80 nginxreverseproxydotnetcorelinux\nEdit Hosts file:      When you go to localhost you will see nginx default page\n                      Mac: /private/etc/hosts \n                      Windows: C:\\windows\\system32\\drivers\\etc\\hosts\n                      ADD: 127.0.0.1   docker.azurewebsites.net\n                      Now load docker.azurewebsites.net and you should see your app\n                      Ctrl+C to stop\nClean Up Docker:      docker stop $(docker ps -aq) | docker rm $(docker ps -aq)\nUpload to Azure ACR:\nLogin Registry:       docker login REMOVED.azurecr.io --username REMOVED --password \u003c\u003cREMOVED\u003e\u003e\nTag:                  docker tag nginxreverseproxydotnetcorelinux:latest REMOVED.azurecr.io/nginxreverseproxydotnetcorelinux:latest \nPush:                 docker push REMOVED.azurecr.io/nginxreverseproxydotnetcorelinux:latest\n```\n\n### What I changed in the \"dotnet new web\" app\nIn the file nginxproxy.csproj make sure your Target Framework is 2.1\n```\n\u003cPropertyGroup\u003e\n\u003cTargetFramework\u003enetcoreapp2.1\u003c/TargetFramework\u003e\n\u003c/PropertyGroup\u003e\n```\n\nIn the program.cs make sure you have the UseUrls line:\n```\nWebHost.CreateDefaultBuilder(args)\n   .UseStartup\u003cStartup\u003e()\n   .UseUrls(\"http://*:5000/\")\n   .Build();\n```  \n\n### Notes\nSince your application name will be different you will mostlikely need to change:\n* You will need to change line 4 in start-server.sh\n  * https://github.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/blob/master/start-server.sh#L4\n* You will need to change line 10 in start-server.sh\n  * https://github.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/blob/master/start-server.sh#L10\n* Publish release mode: (dotnet publish --configuration Release)\n  * You will probably build in Release mode so you will need to change line 83 in the Dockerfile\n  * https://github.com/AdamPaternostro/azure-web-app-nginx-reverse-proxy-dotnet-core-linux/blob/master/Dockerfile#L83\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadampaternostro%2Fazure-web-app-nginx-reverse-proxy-dotnet-core-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadampaternostro%2Fazure-web-app-nginx-reverse-proxy-dotnet-core-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadampaternostro%2Fazure-web-app-nginx-reverse-proxy-dotnet-core-linux/lists"}