How to Install Free SSL on an Apache VPS

How to Install Free SSL on an Apache VPS

If you are building a website entirely via SSH and using Apache (LAMP Stack) on a VPS, you can easily install a free SSL on Apache, which we will cover in this tutorial.

Before that, this tutorial is a continuation of How to Install WordPress on Debian 10 so the folder and virtual host configurations are the same. If you have not checked the previous tutorial, you can take a look at it first.

How to Install Free SSL on an Apache VPS

Before starting, ensure your domain is pointed to the hosting. If it is already pointed to the server but SSL is not yet installed, you will receive a message ERR_CONNECTION_RESET when accessed.

Cara Install SSL Gratis di Apache VPS - WPGan.com - 0

Once you have confirmed the domain is pointed to the server, you can proceed to the first step:

1. Install Certbot

For a free SSL, you can use Certbot and you will be able to get a free SSL from Let’s Encrypt

sudo apt install certbot python3-certbot-apache -y

If you are using RHEL, Rocky, or Alma, you can install it using this command:

sudo dnf install epel-release -ysudo dnf install certbot python-certbot-apache -y
Cara Install SSL Gratis di Apache VPS - WPGan.com - 1

2. Ensure VirtualHost is Active

Double-check that the VirtualHost is active and your domain is correctly pointed to the server

sudo apache2ctl configtest

Ensure the result of the configtest command produces Syntax OK. If it is not yet active, you can enable the VirtualHost first

sudo a2ensite nasikinsudo systemctl reload apache2

Change nasikin with the name of the VirtualHost you created.

Cara Install SSL Gratis di Apache VPS - WPGan.com - 2

3. Request an SSL Certificate

Now for the most important step. You can request a free SSL with Certbot directly without needing to reconfigure the VirtualHost if it was already valid previously

sudo certbot --apache -d nasikin.web.id -d www.nasikin.web.id

Change nasikin.web.id with your domain name, for example, we are using the domain here ini.contohnya.web.id

Cara Install SSL Gratis di Apache VPS - WPGan.com - 3

Make sure to agree to the terms and enter your email when requesting. Once it is successfully issued, you will receive information on where the CRT and Key are stored.

4. Access the Website

After the SSL is successfully issued and Certbot has deployed the SSL certificate, you can immediately access the website without needing additional configuration.

Cara Install SSL Gratis di Apache VPS - WPGan.com - 4

When the SSL is properly installed, you will no longer receive the message when accessing the website via HTTPS ERR_CONNECTION_RESET.

Those are the steps and the easy way to install a free SSL on Apache or a LAMP Stack on a VPS, which you can try when deploying applications without using a control panel.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...