Tech notes

Some notes about technology I use, just so I don't forget.

Setting up an HTTPS server

Ingredients:

To set this up I just needed a virtual machine running Ubuntu. For each domain I wanted to host, I'd point its DNS A record to the VM's IP and create an entry like this in /etc/nginx/sites-available/:

server{
  listen 80;
  listen [::]:80;

  server_name leoadonk.com;
  root /var/www/leoadonk_com/;
  index index.html;
  
  location / {
    try_files $uri $uri/ =404;
  }
}

Assuming I already had an index.html file in /var/www/leoadonk_com/, I'd create a symbolic link in /etc/nginx/sites-enabled/ pointing to the entry in sites-available and reload nginx with systemctl reload nginx. At this point I would be able to see an HTML website at http://leoadonk.com.

To handle HTTPS, I'd install Certbot with snap install --classic certbot and then run certbot. This would make the HTTPS version of the website available at https://leoadonk.com.