Open any SSH tool like putty
Open SSH and execute following commands
sudo apt update
sudo apt install vsftpd
sudo service vsftpd status
Dotnet Core Api with Nginx load balancer in Linux
Go to VS PMC or open CMD in app directory and exec following command
dotnet publish
then..
Copy published files to Linux
I assume Nginx load balancer already configured.
Load balancer config
server {
listen 80;
server_name example.com;location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}}
restart nginx
systemctl restart nginx
To keep api running
Create service
sudo nano /etc/systemd/system/Example.service
Service configuration
[Unit]
Description= NET Core application on Ubuntu[Service]
WorkingDirectory=/var/www/html/Example/
ExecStart=/usr/bin/dotnet /var/www/html/Example/Example.Api.dll
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=offershare-web-app
Environment=ASPNETCORE_ENVIRONMENT=Production[Install]
WantedBy=multi-user.target
Service commands
sudo systemctl enable Example.service
sudo systemctl start Example.service
sudo systemctl status Example.service
Do not forget to follow me :)
Congratz. You did it.