Deploy Node.js App To Digital Ocean Server

In this video we will go step by step to deploy a Node.js application to a Digital Ocean server/droplet. Here is a rundown of what we will do…

1. Setup a Digital Ocean droplet (Use link below for $10 free)
2. Add SSH Keys Using PuttyGen
3. Connect using Putty, create new user
4. Secure server by disabling root
5. Install Node.js and Git
6. Clone Node/Express app from Git
7. Install PM2 to run app as a process
8. Run app on port 80
9. Connect a domain name to our app

$10 FREE SIGNUP LINK:
https://m.do.co/c/5424d440c63a
Blog Post – http://www.traversymedia.com/deploying-node-js-to-digital-ocean/

SUPPORT THIS CHANNEL WITH A CUP OF COFFEE PER MONTH:
http://www.patreon.com/traversymedia

ONE TIME DONATIONS:
http://www.paypal.me/traversymedia

Comments

Bit Book says:

Thanks bro, perfect explaining.

Viraj Mohite says:

Bravo!!! man…you nailed it….

Sathiyaseelan L says:

Nice one

Alejandro Salgado says:

So, I cloned my repository without using a SSH Key, since the server allowed me to do that for some reason. I have a SSH connection to the server; and, when I get into the project folder, and run my node app, the console says “server started” (as my index.js indicates to); however, when I try to connect to the server at my serverip:8080/, it just never connects (time exceed). I tried changing the port several times, and using both Firefox and Chrome, but nothing. Do you have any idea why this is happening? I do not have NGINX nor a certificate from Lets Encrypt installed.

satranç kardeşliği says:

Great tutorial! but process is to long. Is not easy for beginner

Austin Stevens says:

Awesome tutorials my dude. Learning so much!

Gol D. Roger says:

The blog post is not working brad.

Alexandros Markovic says:

Brad you are a life saver! I had two days for a sudden deadline to deploy and this step by step really saved me! Thank you man… I was trying to deploy a Nuxt app through Dokku as suggested in it’s documentation but i was stuck with the ssh ( through windows… ) , the support hasnt helped for 5 hours now ( might have been a noob error or something ) so i tried your way with clean ubuntu and it worked after a couple minor things… Thanks man…

Muhammad Mairaj says:

Also you can use Filezilla in place to winscp.

Muhammad Mairaj says:

For the curious, this tutorial should be just as applicable to Vultr.com, Linode servers as it is Digital Ocean. The only difference between Digital Ocean and other cloud-hosting providers is of branding and a bit or two of hardware. Other than that, they all provide Linux machines. So any command that works for Digital Ocean MUST work for Vultr.com, or Linode.com or Amazon Web Services.

SuperRageCraze says:

man thank you so much! I’ve been trying to find someone who can teach me how to use the digital ocean droplet for so long, and since i haven’t used linux before it was a pain in the A**! Thanks alot!

John Simms says:

Great video! Question: What if you wanted to run multiple Node.js apps, each with a different domain name? Possible?

Bani Naveen says:

Hello brad I am not able to run change port 80 command.

GALAGARZA89 says:

If I make a change to my git repository that was cloned how would I go back and update it to see the changes?

Luis Diaz says:

Thank you very much, you are so handsome.

Ariunsanaa says:

I see my app is running message in console. But i can’t see it in browser. I wrote the address as instructed. “IP address + :5000” What can be a problem, any idea?

Shahnewaz Rico says:

Putty is for window. For mac which tool i can use?

VipZip says:

Awesome guide, I found this link https://m.do.co/c/7f7024d46fc6 I signed up and received free 10$ :)

Franco Mac says:

wow this video saved my life! I’ve been researching about this for a while, I got stuck with SSH part, now with your video, everything is clear to me! thanks man!

Alex Key says:

excellent tutorial. which one would you recommend based on your experience? heroku or digital ocean for a relatively medium sized web app?

Brian Norlander says:

Excellent tutorial!

Ethan Brimhall says:

Thanks!

Marcelo Astudillo says:

it is necessary to open the port with “sudo ufw allow 5000”

Rob says:

Great video! got my site up and running!

Ryan Moody says:

I can’t change any files. Nothing I do will edit the index.js file. Been changing the “Hello World” to anything either using sudo or the winscp

Deep Trivedi says:

Hello Brad,
Thank you for all the awesome tutorials and courses that you’ve posted!! This comment is for a video request.
Could you do a video to dockerize a Node JS application and run it in a container? Love you channel!!

p m says:

what happened to that Blog post?? 404 not found.

Bimal Grg says:

Please make video on Google cloud

pftdetroit says:

Followed along the whole way and it was really helpful. Thanks!

Rajan Lagah says:

putty showing me connection time out. any help please

Albert Barrientos says:

I would like to install on a subdomain like “http://testing.codelearnet.net/” my React versión to test my software and work with git. Is it possible? Who can I do it? Thank you!

Archemi says:

Thank you, You are the best

Pursharth vohra says:

your are life saver, i really appreciate your work and i learned a lot your channel. I hosted my app on AWS EC2 free tire and suddenly it crashed and said my account is not valid. Then follow your video and my site is up again in 30 min. Thanks mate

Mark Faine says:

Good video. A few things I’d suggest: Maybe use systemd instead of pm2. I just would rather focus on using tools that are available on the system than reaching outside for 3rd party stuff. libcap2 seems a bit hacky too. I can see that it works but Linux is actually designed to not allow non-root owned processes on ports lower than 1024 for a reason. I would expect to see something like reverse proxy or iptables being used, though for testing that is probably fine. A Google search seems to suggest that it’s even possible to have an express app drop privileges after it binds to the port, that would be something I’d be interesting in knowing how to do since it’s going to be necessary at some point. Which brings me to my final observation – SSL. how could this be run on SSL and how do you integrate the certificate into the app? I understand this final point might be outside the scope of this tutorial but I still think that is something that is something you’re going to need to know eventually. All in all though a great starter video on how to deploy to a Digital Ocean server. Thank you, though you really make me want to do some Linux tutorials. Windows people work so hard at not doing things the easy way with Linux tools.

Ash Ketchum says:

Thanks!!

Robert Hutchins says:

Very nice video, Brad! Could you repost the blog for this tutorial, please?

bismiksm says:

Man, you just made it happen!!!! Thank you so much to initiate me to server administration!!! I just mention that i followed your tutorial to deploy on another hosting company with a mac and it works!!!! Best regards!!! Max

brett garvey says:

Wow this is great thanks (:

Rubin Bajracharya says:

The Blog Post link is down. It shows 404 Error

engineer diaries says:

Hey the blog post doesnt exit?

Shyam Vadeyar says:

Thank you ^ 100. You helped me deploy a website in an hour. Do you have any tutorial to add SSL certificate to the newly created website?

Boaz Poolman says:

For every student following this course you can get $50 free on DigitalOcean via https://education.github.com/pack

Amarveer Singh says:

Thanks

AndriyFM says:

create ssh key is easy 6:37

Alishan Ali says:

Thank you so much! my project is online now BUT HOW DO I UPDATE MY CODE once winscp pm2 start index.js ?? Please comment back here @Traversy Media

CMS Friendly says:

Excellent Job!!!

Java Selva says:

really your tutorial is very helpful bro, very great..,

Alishan Ali says:

Ok Another Question: HOW DO I COMPILE TYPESCRIPT once I change the .ts file? @Traversy Media
sh: 1: tsc: Permission denied <– error on ubuntu

Sunny Kumar says:

Get $10 credit from this signup link http://www.digitalocean.com/?refcode=588259f170dd

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours