Would you like to learn how to enable the HSTS feature on the Nginx server? In this tutorial, we are going to show you how to enable on Nginx the feature called HTTP Strict Transport Security.
• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Nginx 1.18.0
In our example, the Nginx 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.
Nginx – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Nginx.
Tutorial Nginx – Enable HSTS
Install the Nginx server.
Edit the Nginx configuration file for the website.
On the HTTPS area, add the following lines to this configuration file.
Optionally, include the PRELOAD option on the HSTS header.
Make sure that you have an HTTPS website configured on the Nginx server.
As an example, here is our configuration file.
Restart the Nginx service.
In our example, we configured the HSTS feature on the Nginx server.
From a remote Linux computer, try to access an HTTPS page.
Here is the command output.
Congratulations! You enabled the HSTS feature on the Nginx server.