Would you like to learn how to enable the HSTS feature on the Apache server? In this tutorial, we are going to show you how to enable on Apache the feature called HTTP Strict Transport Security.

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

In our example, the Apache server is hosting the website WWW.GAMEKING.TIPS

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 HSTS

Install the Apache server.

Copy to Clipboard

Enable the required Apache modules.

Copy to Clipboard

Edit the Apache configuration file for the website.

Copy to Clipboard

On the HTTPS area, add the following lines to this configuration file.

Copy to Clipboard

Make sure that you have an HTTPS website configured on the Apache server.

As an example, here is our configuration file.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

In our example, we configured the HSTS feature on the Apache server.

From a remote Linux computer, try to access an HTTPS page.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Congratulations! You enabled the HSTS feature on the Apache server.