#!/bin/sh
set -eu

sudo install -o root -g root -m 0644 \
  /home/simple/whoneedhelp.imalto.site.conf \
  /etc/nginx/sites-available/whoneedhelp.imalto.site

if [ ! -L /etc/nginx/sites-enabled/whoneedhelp.imalto.site ]; then
  sudo ln -s \
    /etc/nginx/sites-available/whoneedhelp.imalto.site \
    /etc/nginx/sites-enabled/whoneedhelp.imalto.site
fi

sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx --redirect -d whoneedhelp.imalto.site
sudo nginx -t
sudo systemctl reload nginx
