Node JS Hosting application
to Sakshamapp WH Server is simple and shoddy in expense. You can start with $5
fundamental project to have your first Node.js application live on Server. On
the off chance that you willing to purchase a single tick here to get $10
rebate on your first Server with Sakshamapp WH.
What we’re going to do
In this article we are going to have Node.js application in our Sakshamapp
WH Server. Our application will be Google recaptcha structure utilizing Node.js
which we have secured in past article.
This article won't cover every last essential strides require, for
example, purchasing server, setting up fundamental Nginx Server and so on in
light of the fact that I trust people at Sakshamapp WH have officially
sufficiently composed article on it.
This article just spotlights on "Node JS Hosting application
on a sub-area".
Requirements
We are expecting you have your Sakshamapp WH Server prepared with Nginx
introduced or most likely running your online journal or site on same ( Like we
are doing ). On the off chance that you don't have one and need in the first
place, click here to purchase your first Sakshamapp WH server with $10
rebate. Preparation
You require couple of things prepared before you move to next stride,
they are:
- Git
- Node and NPM.
- PM2
Login to your Server and install them if you don’t have already, else
move on to next section.
Introduce git
Run taking after charge
sudo apt-get install git
Introduce most recent Node.js
Pursued after charge each other.
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
Introduce PM2
Run taking after charge to introduce PM2 all around.
npm i -g pm2
Setting up task
Clone your task from Github.
git clone https://github.com/
Switch to folder and install required dependencies.
cd google-racapcha-node && npm install
Hosting Node.js app
To have our application we require sub area. We should make one from Sakshamapp
WH control board.
Create sub domain
Go to Sakshamapp WH account then tap on Networking and select View
fundamental area.
Make new sub space say google-recaptcha and put your IP in second box.
Make Nginx config and include new piece of this code into your config
record. This most likely be situated in/and so forth/nginx/conf.d/registry.
server {
listen 80;
server_name sub-domain.domain.com;
root /usr/share/nginx/html/node;
index index.html index.htm;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:--PORT--];
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
Replace –PORT– with the port
number on which Node.js app is running.
Deploy app
Go to Node project folder and start it with PM2.
Restart nginx by using following command.
sudo service nginx restart
Restart nginx by using following command.
sudo service nginx restart
No comments:
Post a Comment