Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

Serve a SPA like Angular or React on Azure App Service for Linux

Serve a SPA like Angular or React on Azure App Service for Linux
February 11, 2022 2 min read BEN ABT
Azure Angular

This article was written in 2022. Versions, tools and recommendations may have changed since then. Newer posts are collected under Azure.

In many scenarios it can make sense to host single page applications via an Azure Web App, for example if you have many small applications - then the Static Web App will simply be more expensive. Likewise, it can be very convenient to host a Single Page Application on Web Apps if you have the App Service Plan anyway because you run multiple APIs with it.

Now, with the App Service for Linux, unlike its Windows brother, each web app runs in its own container. And from a container it is not so easy to deliver static files like HTML, CSS or JavaScript - because the default configuration simply does not do this. We need a web server.

For this purpose, we can simply use the NodeJS runtime of the web app. Here a sample [https://learn.microsoft.com/en-us/azure/app-service/provision-resource-bicep?WT.mc_id=DT-MVP-5001507) file:

Bicep
 1resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' existing = {
 2  name: youAppServicePlanName
 3}
 4
 5resource webApp 'Microsoft.Web/sites@2021-02-01' = {
 6    name: yourWebAppName
 7    location: yourAzureLocation
 8    properties: {
 9        serverFarmId: yourAppServicePlanId
10        siteConfig: {
11            linuxFxVersion: 'NODEJS|16-LTS'
12            alwaysOn: true
13            http20Enabled: true
14            webSocketsEnabled: false
15            autoHealEnabled: true
16            detailedErrorLoggingEnabled: true
17            ftpsState: 'Disabled'
18        }
19        httpsOnly: true
20        clientAffinityEnabled: false
21    }
22    identity: {
23        type: 'SystemAssigned'
24    }
25    tags: tags
26}

Now we need a web server, in this case an Express Server, which is available by default with NodeJS on Azure Web App on Linux.

JavaScript
1var express = require('express');
2var server = express();
3var options = {
4  index: 'index.html'
5};
6server.use('/', express.static('/home/site/wwwroot', options));
7server.listen(process.env.PORT);

This is now configured as part of the Angular project via the index.js, which should deliver the index.html.

Done.

Your container now serves a static web app via NodeJS with great performance!

Related articles

Automatic TTL in Azure Cosmos DB with .NET

Aug 17, 2026 - 17 min read

Automatic TTL in Azure Cosmos DB with .NET

Temporary data is easy to create and surprisingly difficult to remove reliably. Sessions, idempotency keys, import buffers, transient …

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Jul 19, 2026 - 8 min read

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Azure Static Web Apps is primarily a host for static frontend assets, but it can also deploy a small HTTP API alongside the frontend. That …

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Jul 12, 2026 - 14 min read

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Hono is often associated with Cloudflare Workers and for good reason. Its small routing model, Web Standard API surface and direct fetch …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026
Problem Details in ASP.NET Core and .NET 11

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026
Resilience in .NET with Microsoft.Extensions.Resilience

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026
What Matters in ASP.NET Core 11

What Matters in ASP.NET Core 11

Sep 14, 2026

Tags

.NET (192) Csharp (96) ASP.NET Core (48) Azure (41) DevOps (17) Docker (14) Microsoft (14) EF Core (11) Microsoft MVP (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Security (9) Synology (9) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7) Bicep (6)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact