Step install dot Net Core webservice ubuntu

Step install dot Net Core webservice ubuntu

#sudo apt-get update
#sudo apt-get upgrade

Install .NET Core 2.0
#sudo apt-get install dotnet-sdk-2.0.0

Install Git
#sudo apt-get install git

Install NPM (if your project relies on NPM to build or publish)
#curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
#sudo apt-get install npm

Give new user permissions to use NPM
#sudo chown -R $USER:$(id -gn $USER) /home/[USERNAME]/.config
sudo chown -R $it-dept:$ /home/it-dept/.config

install nginx
#sudo apt-get install nginx

Create the Nginx reverse proxy settings.
sudo nano /etc/nginx/sites-available/default

server {
         listen 80;
         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;
         }
     }


#sudo nginx -t

Place the raw unpublished project files in "/home/[USERNAME]/website" directory
# /home/it-dept/WebService/publish
ls

Publish the project to [PUBLISH_DIRECTORY]
#dotnet publish -c Release -o [PUBLISH_DIRECTORY]

Create the kestrel service definition file.
#sudo nano /etc/systemd/system/[SERVICE_NAME].service
sudo nano /etc/systemd/system/CimoryTurbagi.service

     [Unit]
     Description=Cimory Turbagi Web Service

     [Service]
     WorkingDirectory=/var/www/CimoryTurbagiServices/publish
     ExecStart=/usr/bin/dotnet /var/www/CimoryTurbagiServices/publish/CimorySalesForceWebService.dll
     Restart=always
     RestartSec=10
     SyslogIdentifier=dotnet-CimoryTurbagi
     User=www-data
     Environment=ASPNETCORE_ENVIRONMENT=Production

     [Install]
     WantedBy=multi-user.target

Enable your new service to auto-start on system boot.
#sudo systemctl enable CimoryTurbagi.service

Reboot the system

Verify that your service is running without error.
#sudo systemctl status [SERVICE_NAME].service

sumber : https://medium.com/@JohGeoCoder/deploying-a-net-core-2-0-web-application-to-a-production-environment-on-ubuntu-16-04-using-nginx-683b7e831e6

0 Response to "Step install dot Net Core webservice ubuntu"

Post a Comment