How to Install Free SSL Certificate for Nginx on Debian 10

TLS and SSL protocols cipher the connection between a site (or other service, but in this tutorial Nginx is the focus) and a client or web browser avoiding sniffers or MiM (Man in the Middle) attack from spying communication. A couple of years ago Google demanded all webmasters to use SSL, also for sites  without sensitive information exchange making this protocol a must also for marketing purposes (SEO).

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, 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:

# apt install nginx -y

You should be able to access your web server through your browser at (localhost).

Now create a configuration file for your website using nano, on the terminal run:

# nano /etc/nginx/sites-available/

Within the newly created file input the content shown in the image below, replacing for your domain name.

server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/;
index index.html;
location / {
try_files $uri $uri/ =404;

After adding the lines above (replacing for your domain), press CTRL+X to save and exit the nano text editor.

Then create a symbolic link to /etc/nginx/sites-enabled/ by running:

# ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Now create a directory /var/www/<yourdomain>

In my case:

# mkdir /var/www/

# sudo service nginx start

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:

# apt install certbot python-certbot-nginx -y

To start the configuration process to add a SSL certificate to Nginx and redirect all http traffic to https run:

# sudo certbot –nginx

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 (, 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

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install NGINX on CentOS

In the case of any web server, the performance is something that you need to keep in mind. In fact, performance is the...

How to Use URL Rewriting

URL Rewriting is a process of changing the request URL to something else as defined in the web server. Nginx uses ngx_http_rewrite_module...

How to Install, And Configure a Nginx Server For the First Time

Nginx is one of the popular web servers, and is used as a proxy server, reverse proxy server, load balancer. It’s a popular...