Only one SSL certificate per bench instance

Okay, the syntax there is incorrect.

According to the official bench command guide, it should be:

bench setup add-domain --site site1.local [your.domain.here]

bench setup nginx

sudo service nginx reload

And when it comes the certbot guide, I have not found any that work as well as the use of snapd to handle all of the complicated settings so I don’t have to deal with them. Here is the short version of using snapd to install certbot and get your ssl certificate:

  • First we need to make sure that ‘certbot’ is not already installed, so we will attempt to remove it just in case
    sudo apt-get remove certbot

  • Now we are going to install the package bundle provider and make sure it is all up-to-date with the latest release of ‘snapd’ and let it handle the certbot for us
    sudo apt install snapd
    sudo snap install core
    sudo snap refresh core

  • Now we use ‘snap’ service to automatically install and configure certbot to work perfectly with your new ERPNext server
    sudo snap install --classic certbot
    sudo ln -s /snap/bin/certbot /usr/bin/certbot

  • Now we can safely use the pre-configured certbot to install your SSL certificate
    sudo certbot --nginx

(The system will pause at some point and ask you to select the site name you wish to install the certificate from a list of names it found. Be sure to select the URL you used and not ‘site1.local’ at this point)
Be patient. This process looks like it is not doing anything sometimes for as long as 60 to 90 seconds, but it is actually working in the background. It will respond with questions you need to answer.

One more thing to note…
If you have multiple URL’s pointing to the same site (site1.local) then you will see in the list of sites to select from all of those URL’s plus the site1.local. Run the “sudo certbot --nginx” command multiple times to get certificates for each of the URL’s in your list. Just select a different one each time you run the command. (Don’t select site1.local as it is not a valid URL) I have this scenarios running on several servers right now so I know it works.

Now the next logical question is: “Will this woirk on my system now that I have been messing with all of the files and settings?”

The answer is that I do not know. I use the above set of instructions with all of my new installs and I never try any of the complicated methods you find in google searches or here on the form. I only use the snapd method now.

I never rename the bench or the site1.local directory. The bench commands I use and the snapd certbot method take all of that into consideration for me and work flawlessly for my new installs.

Hope this helps… Trying to figure out all of the syntax for certbot and how to edit all the right files is problematic. The snapd method above avoids all of that.

BKM

3 Likes