Adding a trusted self-signed SSL certificate to Nginx on Debian/Ubuntu

Adding a trusted self-signed SSL certificate to Nginx on Debian/Ubuntu


In this video I will explain how to add a trusted self-signed SSL certificate to the Nginx server on the Debian/Ubuntu operating system Let’s start with this important section We need to create a configuration file for OpenSSL by running the command in the terminal Copy and paste the following prepared configuration into a new file, where DNS.1 is the name of your server Save the changes and close the file Now let’s create a self-signed SSL certificate with a private key using our configuration file In the process of generating the certificate, several questions will be asked. You can skip them for testing Let’s enable SSL in the Nginx server configuration Edit the server configuration file /etc/nginx/sites-available/default We will specify listening on port 443 (HTTPS) and the path to the certificate and private key files Save the changes and close the file Check the configuration for validity by running the command in the terminal Now apply the configuration changes by running the command in the terminal Now we need to add the generated SSL certificate to the database that the browser uses Before any software installation, it is recommended to update the list of repository packages by running the command in the terminal Install the libnss3-tools package by running the command in the terminal Let’s add the generated SSL certificate to the database using the certutil utility by running the command in the terminal In order for the browser to read the updated certificate database, you need to restart your browser (close and reopen) Let’s check that our Nginx server is accessible via the HTTPS protocol by entering the following address in the browser If you did everything correctly, you will see that the browser has begun to trust your self-signed certificate Your connection will now be encrypted using the HTTPS protocol without displaying a warning about an insecure connection