Let's Do Hosting of Node Server with Mongo DB. Below Link will help you a lot
Step 1: Buy VPS hosting from https://www.a2hosting.com/ ( https://www.a2hosting.com/vps-hosting ).
Step 2: Configure Your DNS servers
![](https://static.wixstatic.com/media/a27d24_2f97bdd9d78a451894501fe45f77d863~mv2_d_2460_1258_s_2.png/v1/fill/w_980,h_501,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_2f97bdd9d78a451894501fe45f77d863~mv2_d_2460_1258_s_2.png)
![](https://static.wixstatic.com/media/a27d24_ccc41f056795455581f19191ace476e3~mv2_d_2498_1278_s_2.png/v1/fill/w_980,h_501,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_ccc41f056795455581f19191ace476e3~mv2_d_2498_1278_s_2.png)
![](https://static.wixstatic.com/media/a27d24_d0f2b5b3eeeb476082c9e0067768220a~mv2_d_2500_1268_s_2.png/v1/fill/w_980,h_497,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_d0f2b5b3eeeb476082c9e0067768220a~mv2_d_2500_1268_s_2.png)
![](https://static.wixstatic.com/media/a27d24_37b7dcefeab24bd59d79654901238689~mv2_d_2520_1272_s_2.png/v1/fill/w_980,h_495,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_37b7dcefeab24bd59d79654901238689~mv2_d_2520_1272_s_2.png)
![](https://static.wixstatic.com/media/a27d24_bce557dde08b436ca9d944c4ee6cd13e~mv2_d_2512_1260_s_2.png/v1/fill/w_980,h_492,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_bce557dde08b436ca9d944c4ee6cd13e~mv2_d_2512_1260_s_2.png)
As show in above screen shot. In first row under hostname enter your domain name like akaroinvoices.rocks and keep Record type already selected option A(address). In Address field enter your ip address without port number.
In second row under host name enter @ as shown in screen shot. In Record type select default A(address). In Address field type your IP address without port number.
3. Once DNS are configured and domain is mapped then login in SSH
-> On Mac Terminal->Shell-> New Remote Connection-> Then select "Secure Shell (ssh)"
-> Add your domain IP in right column
-> Pass your root username
-> Click Connect
-> Then enter your root user password
-> Now you are connected to your server shell
![](https://static.wixstatic.com/media/a27d24_2dadc9dc90274ae29ef2f44a3990fcc1~mv2.png/v1/fill/w_980,h_1092,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/a27d24_2dadc9dc90274ae29ef2f44a3990fcc1~mv2.png)
4. Install Node JS from terminal. Follow the below link:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04
5. Install Mongo-Db from terminal. Follow the below link:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
6. Now you have both node js and mongo db on your server. You can run the mongo db by below commands:
mongod
mongo
and for node js
install nodemon by using command : sudo npm install -g nodemon
and run command: nodemon start
7. Now hit the url or IP of your server and you will see your node server working.
8. But for running the node js and mongodb in background we need to start services.
so for mongodb you start service by below command:
sudo service mongod start
9. To run node js service you need PM2. Follow the below link:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
10. Run the command by navigating to your project folder:
pm2 stop app.js and your production server ready.
Comentarios