FS PBX ssl instruction

ou812

Member
Nov 2, 2016
58
8
8
62
I have looked at the wiki in regards to setting up lets incrypt, but it doesn't say if it is possible to set up sub domains and if it can will it auto renew.
 

hfoster

Active Member
Jan 28, 2019
688
84
28
35
I have a strong feeling it just continually changes the 'fusionpbx' nginx site instead of creating new ones. We personally use a little script and just the Debian provided certbot, I created a template.conf from the default site with 'example.domain' as the location for the cert and domain name. Oh, you might need to look at where the cert signing is done too, as I think I changed the default of 'dehydrated' to 'letsencrypt' for clarity:

Bash:
#!/bin/bash
# Script to generate domain configurations for nginx
set -o errexit;

function generatepbx {
    DOMAIN=$1

    certbot certonly --webroot -w /var/www/letsencrypt -d $DOMAIN
    cp /etc/nginx/sites-available/template.conf /etc/nginx/sites-available/$DOMAIN
    sed -i "s/example.domain/$DOMAIN/g" /etc/nginx/sites-available/$DOMAIN
    ln -s /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/$DOMAIN

}

if [ -z "$1" ]; then
  echo -e "Domain name is required.\n"
  exit 1
fi

for var in "$@"
do
  generatepbx $var
done