Deploying a static website to a Digitalocean droplet

This is one of those posts that I'm making purely for my own selfish reasons. I have nowhere better to store this information other than my blog, and it's easy to search so, why not.

In this post I'll help out my future self by documenting everything I need to do in order to deploy a static website, with it's own parent-level domain, with HTTPS via letsencrypt/certbot, and how I deploy updates using the scp command.

Step 1 - add a directory under /var/www

We need to create a directory to house the website. Usually, this is simply [domainname]/html. We'll put the website inside html. This post has the step by step of what to do

Step 2 - Add the website content to the directory

Usually this is easily achieved by adding a script to package.json. Looks something like this.

"deploy-prod": "npm run generate; scp -r  dist/* [email protected]:/var/www/DOMAIN/html"

Step 3 - Add https

In the server, run the command certbot, pick the new domain, enable the https redirect, and boom. Done.

You've successfully subscribed to Chris Dermody
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.