Skip to content

Instantly share code, notes, and snippets.

@dewwwald
Last active December 20, 2016 16:41
Show Gist options
  • Save dewwwald/bfa75326ab00a4a7ff2994a21204c57b to your computer and use it in GitHub Desktop.
Save dewwwald/bfa75326ab00a4a7ff2994a21204c57b to your computer and use it in GitHub Desktop.

#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;        	
        }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment