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/system
sudo nano omdashboard.service
[Unit]
Description=ASP.NET Core Web App running on Ubuntu
[Service]
WorkingDirectory= /var/www/OM_Dashboard/OM_Dashboard
ExecStart=/usr/bin/dotnet /var/www/OM_Dashboard/OM_Dashboard/OM.Dashboards.API.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-web-app
# This user should exist on the server and have ownership of the deployment directory
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Now turn for RM_Dashboard
sudo nano rmdashboard.service
[Unit]
Description=ASP.NET Core Web App running on Ubuntu
[Service]
WorkingDirectory= /var/www/RM_Dashboard/RM_Dashboard
ExecStart=/usr/bin/dotnet /var/www/RM_Dashboard/RM_Dashboard/RM.Dashboards.API.dll --urls=http://0.0.0.0:5001
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-web-app
# This user should exist on the server and have ownership of the deployment directory
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Check enable, start and check status of both services
sudo systemctl enable nginx # It might be enabled by default (Optional)
sudo systemctl start nginx # (Optional)
sudo systemctl status nginx # Checks the status of the service
Let's config the nginx server:
cd /etc/nginx/sites-available
ls
sudo mv default default2 # (Backup purpose)
sudo nano default # new default config file