Hier I already gave one example how to install Nginx, now here is example how to install ASP.NET Core 10 Application on Ubuntu 24.04 with Nginx.
This guide explains how to deploy an ASP.NET Core 10 application from a Windows 11 development machine to an Ubuntu 24.04 server running inside VMware. It covers installing the .NET runtime, publishing the application, copying it to Ubuntu, testing it manually, and configuring it as a systemd service.
Install the .NET 10 Runtime
Download and install Microsoft's package repository.
wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt update sudo apt install -y aspnetcore-runtime-10.0
Verify the Installation
dotnet --info
You should see output similar to:
.NET SDK: Version: 10.0.xxx Host: Version: 10.0.xxx Architecture: x64 RID: linux-x64 .NET runtimes installed: Microsoft.AspNetCore.App 10.0.xxx Microsoft.NETCore.App 10.0.xxx
Publish the Application on Windows 11
On your Windows development machine, open a command prompt in the folder containing your solution (.sln) file.
Publish the application directly to your VMware shared folder.
dotnet publish -c Release -o "\\vmware-host\Shared Folders\ubuntuVmShare\asp"
After publishing completes, the output folder will contain everything needed to run the application.
Copy the Published Application to Ubuntu
Assuming your VMware shared folder is named ubuntuVmShare, copy the published files to the web directory.
sudo cp -a /mnt/hgfs/ubuntuVmShare/asp/. /var/www/html/net/
Change to the application directory.
cd /var/www/html/net/
Locate the Application DLL
Search for the runtime configuration file.
find . -name "*.runtimeconfig.json"
Example output:
./Kanaloa.runtimeconfig.json
The filename tells you which DLL to start. In this example, the application is started with:
dotnet Kanaloa.dll
Run the Application Manually
If everything is configured correctly, you should see output similar to:
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {de507390-fb82-4965-a58a-0e17b6285227} may be persisted to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /var/www/html/net
The Data Protection warning is normal for many server installations and does not prevent the application from running.
Press Ctrl+C to stop the application before continuing.
Create a systemd Service
Create a new service definition.
sudo nano /etc/systemd/system/kanaloa.service
Insert the following configuration:
[Unit] Description=Kanaloa ASP.NET Core API After=network.target [Service] Type=simple WorkingDirectory=/var/www/html/net ExecStart=/usr/bin/dotnet /var/www/html/net/Kanaloa.dll Restart=always RestartSec=5 User=www-data Group=www-data Environment=ASPNETCORE_ENVIRONMENT=Production Environment=ASPNETCORE_URLS=http://127.0.0.1:5000 [Install] WantedBy=multi-user.target
Save the file (Ctrl+S) and exit Nano (Ctrl+X).
Reload systemd
Reload the service definitions.
sudo systemctl daemon-reload
Enable the Service
Configure the service to start automatically during boot.
sudo systemctl enable kanaloa
Expected output:
Created symlink: /etc/systemd/system/multi-user.target.wants/kanaloa.service → /etc/systemd/system/kanaloa.service
Start the Service
sudo systemctl start kanaloa
Verify the Service Status
sudo systemctl status kanaloa
You should see something similar to:
● kanaloa.service - Kanaloa ASP.NET Core API
Loaded: loaded (/etc/systemd/system/kanaloa.service; enabled)
Active: active (running)
Main PID: 12345 (dotnet)
Tasks: ...
Memory: ...
CPU: ...
The important line is:
Active: active (running)
Summary
Your ASP.NET Core application is now:
- Running on Ubuntu 24.04.
- Listening on http://127.0.0.1:5000.
- Managed automatically by systemd.
- Configured to start automatically whenever the server boots.