1. Download generated config: nginxconfig.io-{{ getDomains().join(',') }}.zip
  2. Upload to server's {{ data.directory_nginx.replace(endingSlashRegex, '') }} directory
    or Copy as Base64 string: Copy to clipboard and Paste from clipboard and run the command
    (echo 'BASE64' | base64 --decode > {{ data.directory_nginx }}nginxconfig.io-{{ getDomains().join(',') }}.zip)
  3. Go to NGINX directory (over SSH):
    cd {{ data.directory_nginx.replace(endingSlashRegex, '') }}
  4. Backup current configuration:
    tar -czvf nginx_$(date +'%F_%H-%M-%S').tar.gz nginx.conf sites-available/ sites-enabled/ nginxconfig.io/
  5. Unzip the uploaded archive:
    unzip -o nginxconfig.io-{{ getDomains().join(',') }}.zip
    (you probably need to install unzip: sudo apt-get install unzip)
  1. Generate Diffie-Hellman keys:
    openssl dhparam -out {{ data.directory_nginx }}dhparam.pem {{ sslProfiles[ data.ssl_profile ].dh_param_size }}
  2. Create a common ACME-challenge directory (for Let's Encrypt):
    mkdir -p {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }}
    chown {{ data.user }} {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }}
  1. Comment out SSL related directives in configuration:
    sed -i -r 's/(listen .*443)/\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certificate) )/#;#\1/g' {{ data.directory_nginx }}nginx.conf {{ data.directory_nginx }}sites-{{ isSymlink() ? 'available' : 'enabled' }}/{{ _domain }}.conf
  2. Reload NGINX:
    sudo nginx -t && sudo systemctl reload nginx
  3. Obtain certificate{{ getDomains().length > 1 ? 's' : '' }}:
    certbot certonly --webroot -d {{ _domain.indexOf('-') !== -1 ? '"' + _domain + '"' : _domain }} -d {{ _domain.indexOf('-') !== -1 ? '"' : '' }}www.{{ _domain }}{{ _domain.indexOf('-') !== -1 ? '"' : '' }} -d {{ _domain.indexOf('-') !== -1 ? '"' : '' }}cdn.{{ _domain }}{{ _domain.indexOf('-') !== -1 ? '"' : '' }} --email {{ data.sites[_site].email ? data.sites[_site].email : 'info@' + _domain }} -w {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }} -n --agree-tos --force-renewal
  4. Reload NGINX:
    sudo nginx -t && sudo systemctl reload nginx
  5. Configure Certbot to reload NGINX after success renew:
    echo -e '#!/bin/bash\nnginx -t && systemctl reload nginx' | sudo tee /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh
    sudo chmod a+x /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh
  1. Reload NGINX:
    sudo nginx -t && sudo systemctl reload nginx