Some notes on setting up a website - something you do sufficiently infrequently to remember quite how it goes.
Choosing a VPS
This is a bit of a quagmire. There is no end to the number of providers of virtual private servers. Lowendbox is where I started.
Virtualization software choice: OpenVZ vs KVM. The most significant distinction AFAICS is KVM can run docker, whereas OpenVZ cannot. Location choice: Expect greater lag the further away it is. I’ve not looked for hard numbers on this.
Configuration choice: There’s a broad spectrum with price tags to match of what resources are allocated. Key resources: memory, cpu, storage and bandwidth. Possibly how many IPv4s come with it, and extras like DDoS protection.
OS: I choose debian derivatives because it’s what I know.
A lot of the providers have almost identical layouts on their purchase page. Makes things a bit easier.
Choose, and purchase.
Find the “manage services” page or equivalent and find the IP number of the server, as well as root password.
Setup
On the local device, add the new machines IP to ~/.ssh/config
.
ssh into the remote machine.
Create a file ~/.ssh/authorized_keys
and add public key.
Add new user, with home dir
sudo useradd -m <username>
Add password
sudo passwd <username>
and/or setup ssh keys as above.
Nginx has complained previously when pointed at files that are owned by root. Hence setting up a nonroot user. Generally, it’s considered a suboptimal practice to hangout in root when you don’t need to. Understandably.
Sync
This tends to be a tedious time sync and at some point I will sort out using dotfiles or create a script or something
Until then, scp
from the local machine to the remote with
scp -r /path/of/source <remote>:/path/of/target
Two key files: ~/.bashrc
, and neovim config ~/.config/nvim
.
Installing the basics so that we can work comfortably on the remote
tree curl git neovim nodejs
Complete the install of neovim with Plug
Nginx + Hugo
Install nginx
and hugo
.
There are no shortage of tutorials on this eg
this.
Setup a basic site with default everything.
Register a domain
- Find a domain name registrar, and a reasonably price domain name.
- Purchase.
- Find (advanced) DNS settings: Add rule of type “A” with the correct destination/ target IP of the VPS.
Organize subdomaining from this point.
Voila.
Visit your new website! 💃