Update server:
sudo apt-get update
Install nginx:
sudo apt-get install nginx
Install nodejs(14.x):
# Install the PPA
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
# Run the PPA
sudo bash nodesource_setup.sh
# Install the Node.js package
sudo apt install nodejs
# Verify that you’ve installed
node -v
# Output
v14.2.0
In case I installed a project that /ver/www/html
Clone the repo:
git clone https://github.com/tickstudiu/<repo name>.git
cd <repo name>
Install the dependencies:
npm install
Generate static project:
npm run generate
shold have folder /dist in <repo_name>
cd /etc/nginx/sites-enabled
Config:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/<repo_name>/dist;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
Check nginx and restart:
# check nginx
sudo ngnix -t
# restart nginx
sudo service nginx restart