Category: Ubuntu

  • Cron Job for Let’s Encrypt nginx standalone renew Ubuntu

    I run nginx as a reverse proxy for sites that use SSL. Normally I’m doing something a bit strange so it doesn’t quite work having certbot manage my configs. This will renew ssl certs at 3am each morning if needed.

    0  3    * * 1   root    /usr/bin/certbot --standalone renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" > /dev/null 2>&1
  • Static Netplan template Ubuntu 20.04

    Editor’s note (2026): `gateway4` shown below is deprecated in current Netplan releases — it still works but throws a deprecation warning. The current-style syntax is a `routes:` block instead. Both are shown here.

    I like to leave a dhcp server up so that when I spin up a virtual machine to tinker with it’ll grab that IP and I’ll be on my marry way.

    If in the event that I want to later statically assign it (the ip) just use the following template and adjust.

    Older / still-working style (deprecated):

    network:
      ethernets:
        ens18:
          addresses:
          - 172.16.0.2/24
          nameservers:
            addresses:
            - 172.16.0.2
            - 8.8.8.8
            search:
            - domain.com
          gateway4: 172.16.0.1
      renderer: networkd
      version: 2

    Current-style syntax using a routes block instead of gateway4:

    network:
      ethernets:
        ens18:
          addresses:
          - 172.16.0.2/24
          nameservers:
            addresses:
            - 172.16.0.2
            - 8.8.8.8
            search:
            - domain.com
          routes:
          - to: default
            via: 172.16.0.1
      renderer: networkd
      version: 2