Both should have exe and dll. (Choose the dll with name of exe)
Let's create the service to deploy OM_Dashboard api first.
cd/etc/systemd/systemsudonanoomdashboard.service
[Unit]Description=ASP.NETCoreWebApprunningonUbuntu[Service]WorkingDirectory=/var/www/OM_Dashboard/OM_DashboardExecStart=/usr/bin/dotnet/var/www/OM_Dashboard/OM_Dashboard/OM.Dashboards.API.dllRestart=always# Restart service after 10 seconds if the dotnet service crashes:RestartSec=10KillSignal=SIGINTSyslogIdentifier=dotnet-web-app# This user should exist on the server and have ownership of the deployment directoryUser=www-dataEnvironment=ASPNETCORE_ENVIRONMENT=Production[Install]WantedBy=multi-user.target
Now turn for RM_Dashboard
sudonanormdashboard.service
[Unit]Description=ASP.NETCoreWebApprunningonUbuntu[Service]WorkingDirectory=/var/www/RM_Dashboard/RM_DashboardExecStart=/usr/bin/dotnet/var/www/RM_Dashboard/RM_Dashboard/RM.Dashboards.API.dll--urls=http://0.0.0.0:5001Restart=always# Restart service after 10 seconds if the dotnet service crashes:RestartSec=10KillSignal=SIGINTSyslogIdentifier=dotnet-web-app# This user should exist on the server and have ownership of the deployment directoryUser=www-dataEnvironment=ASPNETCORE_ENVIRONMENT=Production[Install]WantedBy=multi-user.target
Check enable, start and check status of both services
sudosystemctlenablenginx# It might be enabled by default (Optional)sudosystemctlstartnginx# (Optional)sudosystemctlstatusnginx# Checks the status of the service
Let's config the nginx server:
cd/etc/nginx/sites-availablelssudomvdefaultdefault2# (Backup purpose)sudonanodefault# new default config file