Click On Tyler Support

Contact Us

Support Home » VirtualHostX » How To's

How to use Certbot to Install an SSL Certificate

Last Updated March 15, 2020

VirtualHostX Pro v2020.04 was released on March 15, 2020 and includes a new feature that will let you use Certbot to provide trusted SSL certificates for production websites you host with VHX.

Please Note: This is an advanced topic. I've done my best to make this feature simple to setup and use, but SSL certificates are notoriously tricky business. I'm happy to offer assistance when possible, but please exercise caution if you're new to this sort of thing.

First things first: This feature requires that cerbot is installed in the virtual machine. If you are upgrading from an earlier version of VirtualHostX Pro, you can either let the app install certbot for you or you can do so yourself.

(If you are a new user or first installed VHX on or after March 15, 2020, your virtual machine is already setup and no action is required on your part.)

Installing Certbot

Automatic Certbot Install

VirtualHostX can automatically install certbot for you. This process may take some time depending on your internet connection as it needs to download approximately 1GB of data.

Please Note: This automatic setup process will destroy the virtual machine. Your websites' files will remain untouched. However, you will lose any MySQL databases inside the virtual machine. If you have data you don't want to lose, please follow the manual installation instructions in the next section instead.

To automatically install certbot, follow these steps:

  1. Choose "Update Box..." from the app's "Virtual Machine" menu.
  2. In the confirmation dialog that appears and says "Rebuild Virtual Machine After Updating?", click the "Yes" button.
  3. After the update completes, another dialog will appear that says "Destroy Virtual Machine?". Click "Yes".
  4. You will then be brought back to the Welcome Window. Click the arrow button for Step 2 to re-create your web server.

Manual Certbot Install

If you're running a version of VirtualHostX Pro installed prior to March 15, 2020 and want to maintain your virtual machine customizations - including your MySQL databases - you can follow these steps to install certbot manually.

  1. Click the Terminal button in the app's toolbar to open a new terminal window and login to the virtual machine.
  2. Once the terminal window appears, copy and paste this command and then press return to run it:
sudo apt install -y certbot python-certbot-apache

Configuring Your Website to Use Certbot

Once certbot has been installed, you can configure a website to use a real SSL certificate.

First, make sure the website you want to configure is accessible and working on the public internet. The domain name you want to use for your website should be entered into the "Website Name" field in VHX.

Note: Web browsers will expect your web server to be running on port 80. Either use the "Bind to Ports 80..." command under the "Web Server" menu, or configure your network to forward public port 80 to port 8080 on your Mac.

After you've confirmed your website is publicly accessible, click the Terminal button the app's toolbar to open a command line into the virtual machine. You can run certbot and install an SSL certificate by running this command:

sudo certbot

If this is your first time running certbot, you'll need to answer a few questions first.

Once certbot asks you which domain name you'd like to configure, enter the number for the domain you want. Important: Due to the way VirtualHostX works, please ONLY CHOOSE ONE domain name at a time. If you need to setup additional domain names, configure them separately one after another.

After certbot finishes issuing your SSL certificate, you need to inform VirtualHostX of this change.

  1. Select your website in the VHX sidebar.
  2. Select "Use Certbot SSL Certificate" from the Website → SSL Certificate menu. (That menu item will have a checkmark next to it once selected.)
  3. Save your changes and restart the web server by selecting "Save Changes" from the "Web Server" menu.

🎉 Your website should now be available securely over HTTPS.

If it's not or if the web server is no longer responding, it's possible you may have a misconfiguration in your web server settings. You can check for errors by choosing "Run Config Test..." from the "Web Server" menu.