Would you like to learn how to install Apache and configure the HTTPS feature to use a self-signed certificate on a computer running Ubuntu Linux? In this tutorial, we are going to enable the use of HTTPS on the Apache server and create a self-signed certificate.

• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Apache 2.4.41

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial Apache – Enable HTTPS

Install the Apache server and the required packages.

Copy to Clipboard

Enable Apache module named: Mod_ssl.

Enable Apache module named: Mod_rewrite.

Copy to Clipboard

Edit the Apache configuration file.

Copy to Clipboard

Add the following lines at the end of this file.

Copy to Clipboard

Create a private key and the website certificate using the OpenSSL command.

Copy to Clipboard

Enter the requested information.

Copy to Clipboard

On the option named COMMON_NAME, you need to enter the IP address or hostname.

In our example, we used the IP address 200.200.200.2000.

Edit the Apache configuration file for the default website.

Copy to Clipboard

Here is the file, before our configuration.

Copy to Clipboard

Here is the file, after our configuration.

Copy to Clipboard

Optionally, you may want to redirect HTTP users to the HTTPS version of your website.

In this case, use the following configuration.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

Open your browser and access the HTTPS version of your website.

In our example, the following URL was entered in the Browser:

• https://200.200.200.200

The Apache server will display the HTTPS version of your website.

Apache default page

Congratulations! You have finished the configuration of HTTPS on the Apache server.