Skip to content

Deploy Files to Server

Video Lecture

Deploy Files to the Server Deploy Files to the Server

Description

Now to upload the contents of our ./dist folder to our server using Secure File Transfer Protocol (SFTP).

On windows, you can use WinSCP

Download it from https://winscp.net/eng/index.php and install it.

Add your servers configuration and then connect.

Using the WinSCP explorer interface, navigate to the /var/www/ folder on your server.

Then create another folder named my-project.

Now copy your complete ./dist folder into your new my-project folder.

SSH back onto your server and cd into the /etc/nginx/sites-enabled folder.

#
cd /etc/nginx/sites-enabled

View the contents of the folder.

#
ls

We can delete the default config.

#
rm default

We will create a new config that will serve the contents of our my-project folder.

#
nano my-project

And copy/paste this code belowe into the editor.

server {
       listen 80;
       listen [::]:80;

       root /var/www/my-project;
       index index.html;

       location / {
               try_files $uri $uri/ =404;
       }
}

Press CTRL X and then press Y to save the buffer and exit.

Test that the Nginx config syntax is OK.

#
nginx -t

If it is OK, then restart Nginx.

#
service nginx restart

And check its status.

#
service nginx restart

Now visit your IP address in your browser.

Visit http://[your ip address]

You should see your web application that was just uploaded.

Comments