Get a machine

This is demoed is the stream. I use DigitalOcean, but any host that gives you a virtual machine will work for these instructions. AWS, Azure, and Google Cloud Platform have a free year of service.

The first thing you do when you get this machine should be to set up a user. I will create the cws user with adduser. Note that the password will not show as you enter it. Just type and press enter.

# adduser cws
Adding user `cws' ...
Adding new group `cws' (1000) ...
Adding new user `cws' (1000) with group `cws' ...
Creating home directory `/home/cws' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for cws
Enter the new value, or press ENTER for the default
	Full Name []:
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:
Is the information correct? [Y/n] y

You should log out of root and log in as that user.

Install dependencies

Web server

I will use Caddy for this demo. They have fine install instructions. I recommend reading the Caddyfile quick-start as well.


If using an Ubuntu/Debian host, sudo apt install mongodb-server


To get the latest version of node, ceck out the Nodesource distribution instructions for debian distributions.

Set up DNS

This is demoed in the stream. The details vary, but set up a new A record with whatever IP you have from getting a server.

Transfer the project to the server

I tend to use scp to transfer files to the server. You could use some other sftp client as well. The -r (recursive) flag is useful to ensure that you can transfer directories.

$ scp -r courseware-assignments

Note the : at the end of the SSH server identification. This indicates we are transferring to the "default" directory of the cws user. We could specify by putting a path after that colon. Without it, you will not transfer any files.

Set up the webserver

I use Caddy because it’s simple and allows me to set up automatic HTTPS sites without much work.

For my site, hosted at, the configuration looks like this: (1)

root build (2)

reverse_proxy /v1/* (3)

handle_errors {
	rewrite * /index.html
	root build  (2)
1 Change this to the DNS name of your server
2 Change build to the path of your front-end files
3 Change this port to whatever port your back-end runs on

Angular has documentation for Other webservers.

Secure the webserver

  • Disable root logins!

  • Ensure a firewall is running (ubuntu comes with ufw and it’s nice)

  • Ensure no extra services are running

  • Ensure your backend application only responds to

Using GitHub Pages

You can use GitHub to host sites as well, but they cannot (easily) rely on a backend. To do this, follow the directions of github for sites and commit your built site to your repository. Copy the index.html file to 404.html so that node routing will work.