This tutorial shows how to install a free SSL certificate for Nginx on Debian 10 using Certbot.
For users who haven’t installed Nginx yet the tutorial starts with a fast introduction to Nginx installation and configuration to show the site linux.bz, users who already have Nginx installed and configured can jump to How to Install Free SSL Certificate for Nginx on Debian 10.
Installing Nginx on Debian 10 Buster
Nginx was developed for high performance supporting millions of connections simultaneously. While by default it can only serve static sites contrary to Apache which can serve both static and dynamic sites, dynamic sites may be also served with Nginx aided by Apache or other software.
If you have Nginx not installed on your PC yet this section will show its installation and configuration, if you have Nginx already installed jump to How to Install Free SSL Certificate for Nginx on Debian 10.
To begin installing Nginx on Debian 10 Buster, previous Debian versions or based Linux distributions run:
You should be able to access your web server through your browser at http://127.0.0.1/ (localhost).
Now create a configuration file for your website using nano, on the terminal run:
Within the newly created file input the content shown in the image below, replacing linux.bz for your domain name.
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/linux.bz;
index index.html;
server_name linux.bz www.linux.bz;
location / {
try_files $uri $uri/ =404;
}
}
After adding the lines above (replacing linux.bz for your domain), press CTRL+X to save and exit the nano text editor.
Then create a symbolic link to /etc/nginx/sites-enabled/linux.bz by running:
Now create a directory /var/www/<yourdomain>
In my case:
Now you should be able to access your website through nginx with your browser:
Note for domestic users:
In order to allow access from outside the network, some home users will need to configure their routers to forward necessary ports to their web servers. The following image only shows an example of router configuration page for port forwarding, in your router you’ll need to forward ports 80 and 443 to your Apache computer local IP address.
How to Install Free SSL Certificate for Nginx on Debian 10
The free SSL installation process for Nginx under Debian 10 Buster is pretty easy and fast thanks to Certbot which makes Lets Encrypt SSL certificates easy to install.
You can install Certbot on Debian 10 Buster by running the following command:
To start the configuration process to add a SSL certificate to Nginx and redirect all http traffic to https run:
You can fill all requested fields or leave them blank, the last step allows you to automatically configure Nginx to redirect all unsecure traffic through https.
Conclusion on Free SSL Certificate for Nginx on Debian 10 Buster
The process to install a free SSL certificate for Nginx on Debian 10 Buster is pretty simple and fast thanks to Certbot. The whole process took minutes to install the Nginx web server and configure it with SSL.
Other free options to get free SSL certificates may include SSL for Free (https://sslforfree.com, the short Comodo free SSL licences or Zerossl which I didn’t try yet, but none of them means a quick and simple way like this one.
I hope you found this brief article on How to Install Free SSL Certificate for Nginx on Debian 10 useful, thank you for reading it.
Other Articles related to How to Install Free SSL Certificate for Nginx on Debian 10