How to Install Free SSL Certificate for Nginx on Debian 10

29/12/2020
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 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:

# apt install nginx -y

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:

# nano /etc/nginx/sites-available/linux.bz

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

server {
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:

# ln -s /etc/nginx/sites-available/linux.bz /etc/nginx/sites-enabled/linux.bz

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

In my case:

# mkdir /var/www/linux.bz

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

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

How to Block Hotlinking with Nginx

Nginx is a lightweight web server capable of handling humongous number of requests at a given time without making the server...
29/12/2020

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)...
29/12/2020

Nginx Reverse Proxy

What is a reverse proxy? A proxy server is the one that talks to the Internet on your behalf. For example, if your college’s...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024