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
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
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/* chris@DROPELT-IP:/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.