Deploy Vue JS Application on Ubuntu 20.04¶
Install Node Js¶
I have chosen node 14.x You can change to the version of your choice by indicating the version number. cd ~ curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
View the contents of the setup shell script¶
Run the scriptInstall Node using the following command
Check the node version
For more information, visit this pageClone the project to the server¶
Navigate to project dir
Install Deps¶
Build App For Production¶
Copy Files To Desired Location¶
Make Dir to serve files from
Give permissions
Add your user to the www-data group
Add folder to www-data groupConfigure the nginx server blocks¶
Enter the following contentsserver {
listen 80;
listen [::]:80;
root /var/www/html/eac_rde_frontend;
index index.html;
server_name 196.41.38.246;
# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options SAMEORIGIN;
# disable content-type sniffing on some browsers.
add_header X-Content-Type-Options nosniff;
# This header enables the Cross-site scripting (XSS) filter
add_header X-XSS-Protection "1; mode=block";
location / {
root /var/www/html/eac_rde_frontend;
try_files $uri /index.html;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
expires 1d;
}
error_log /var/log/nginx/eac_rde_frontend.log;
}
Create a symlink
Sam