Deploy Files to Server
Video Lecture
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.
# |
|
View the contents of the folder.
# |
|
We can delete the default config.
# |
|
We will create a new config that will serve the contents of our my-project
folder.
# |
|
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.
# |
|
If it is OK, then restart Nginx.
# |
|
And check its status.
# |
|
Now visit your IP address in your browser.
Visit http://[your ip address]
You should see your web application that was just uploaded.