#Last used by editor December 2016
#Setting up node
echo "installing node"
cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
nano nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
echo "some node packages need this"
sudo apt-get install build-essential
#Setting up Nginx (engine-x) Install Nginx.
sudo apt-get install -yf nginx git
You can deploy your code to your user on the server like this. The
cd ~ && mkdir [project]
sudo ln -s ./[project/public/dir] /var/www/public_html
Copy this code into your default and modify it according to your need.
server {
listen 80;
listen [::]:80;
root /var/www/public_html;
index index.html;
server_name domain.dev www.domain.dev;
location / {
rewrite ^([^.]*[^/])$ $1/ permanent;
try_files $uri $uri/ /index.html =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
location ~ ^/api($|/.*$) {
proxy_pass http://127.0.0.1:8080$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}