How to set up Linux server for core 2 web app and make it visible on internet? Part 3 [Music no 3]

How to  publish site with Visual Studio 2017 to Linux server:


sudo apt-get update

sudo apt-get install openssh-server unzip curl



  1. Go to VS2017 and hit publish on project:
  2.  Set up debug mode on publish:
  3. Download WINSCP.
  4. Create new folder for your app.
  5. Copy all stuf from publish folder to new create folder on server
  6. In Putty go folder where you have copied your app:
    cd //go out from myApp
    cd Music
    dotnet Musiction.API.dll //publish app

    You should to see

    Hosting environment: Production
    Content root path: /root/Music
    Now listening on: http://localhost:5000

  7. Your site is up and running on server, but it is not visible on internet. Open new Putty
    sudo apt-get install nginx
  8. Go to /etc/nginx/sites-available/default. and replace content to:
    server {
        listen 80;
        server_name *;
        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;
  9. Run nginx
    sudo nginx -t //verify if the syntax of the configuration files is correct
    sudo service nginx start
  10. Your site is visible on the internet under address: :)/

Leave a Comment

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *