How one can safe Nginx with Let’s Encrypt on OpenSUSE 15.1/15.2

Let’s Encrypt is a free, automated, and open certificates authority to your web site, e-mail server, database server and extra. This web page exhibits methods to use Let’s Encrypt to put in TLS certificates for Nginx internet server and get SSL labs/safety headers A+ rating on an OpenSUSE Linux model 15.1/15.2.


How one can safe Nginx with Let’s Encrypt on OpenSUSE Linux

The process is as follows to acquiring an SSL/TLS certificates:

Get shopper, run:
git clone nginx config to your area:
vi /and so forth/nginx/vhosts.d/your-domain-name.confAcquire an SSL certificates your area: –situation -d your-domain-name –nginxConfigure TLS on Nginx:
vi /and so forth/nginx/conf.d/your-domain-name.confSetup cron job for auto renewal TLS certificatesOpen port 443 (HTTPS) utilizing firewalld :
sudo firewall-cmd –add-service=https

Allow us to see all steps in particulars.

Step 1 – Set up the required software program (conditions)

Open the terminal after which sort the next instructions. Be sure you replace OpenSUSE Linux software program and kernel utilizing CLI as follows:
$ sudo zypper ref
$ sudo zypper up
Our shopper want curl, wc and different packages. Therefore, we should set up required software program utilizing the zypper command:
$ sudo zypper set up wget curl bc git socat cronie

Set up Nginx on an OpenSUSE Linux

Once more use the zypper:
$ sudo zypper set up nginx
$ sudo systemctl allow nginx.service

Created symlink /and so forth/systemd/system/multi-user.goal.needs/nginx.service → /usr/lib/systemd/system/nginx.service.

Begin the Nginx server and confirm it utilizing the systemctl command:
$ sudo systemctl begin nginx.service
$ sudo systemctl standing nginx.service

nginx.service – The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Energetic: energetic (operating) since Mon 2020-07-06 18:49:32 UTC; 2min 4s in the past
Important PID: 13990 (nginx)
Duties: 2
CGroup: /system.slice/nginx.service
├─13990 nginx: grasp course of /usr/sbin/nginx -g daemon off;
└─13991 nginx: employee course of

Jul 06 18:49:32 opensuse-nixcraft-42 systemd[1]: Beginning The nginx HTTP and reverse proxy server…
Jul 06 18:49:32 opensuse-nixcraft-42 nginx[13989]: nginx: the configuration file /and so forth/nginx/nginx.conf syntax is okay
Jul 06 18:49:32 opensuse-nixcraft-42 nginx[13989]: nginx: configuration file /and so forth/nginx/nginx.conf check is profitable
Jul 06 18:49:32 opensuse-nixcraft-42 systemd[1]: Began The nginx HTTP and reverse proxy server.

Lastly open HTTP port 80 utilizing firewllad on OpenSUSE Linux
$ sudo firewall-cmd –zone=public –add-service=http
$ sudo firewall-cmd –zone=public –add-service=http –permanent
$ sudo firewall-cmd –list-services

ssh dhcpv6-client http

Step 2 – Putting in Let’s Encrypt shopper

We should clone the repo:
$ cd /tmp/
$ git clone
Set up the shopper however first log in as root person utilizing the su command/sudo command:
$ sudo -i
# contact /root/.bashrc
# cd /tmp/
# –install –accountemail [email protected]

How to install on OpenSUSE Linux

Step three – Fundamental Nginx configuration for http server on OpenSUSE

I’m going to create a brand new config for area named (be happy to interchange together with your precise area title) as follows:
# vi /and so forth/nginx/vhosts.d/
Append the next directives:

# http port 80 config
pay attention 80 default_server; # IPv4
pay attention [::]:80 default_server; # IPv6
server_name; # area title
access_log /var/log/nginx/http_opensuse.cyberciti.biz_access.log;
error_log /var/log/nginx/http_opensuse.cyberciti.biz_error.log;
root /srv/www/htdocs;

Save and shut the file. Take a look at nginx arrange and reload the nginx server as follows:
# nginx -t && systemctl restart nginx.service

Step four – Create dhparam.pem file

We have to create a Diffie-Hellman key alternate file as follows utilizing the openssl command:
# mkdir -pv /and so forth/nginx/ssl/
# cd /and so forth/nginx/ssl/
# openssl dhparam -out dhparams.pem -dsaparam 4096
# ls -l

openssl command - DH parameter manipulation and generation

Step 5 – Acquire a certificates for area

We are able to situation a certificates utilizing the Nginx server as configured in step three. Nevertheless, in case your server is behind reverse proxy CDN similar to Cloudflare, use the standalone mode as described beneath.

Subject a certificates utilizing pre-configured Nginx

# DOM=””
# D=”/srv/www/htdocs”
# mkdir -pv $D/.well-known/acme-challenge/
# –webroot “$D” –issue -d “$DOM” –ocsp-must-staple –keylength 4096
## GET ecc cert too. Solely ec-384 or ec-256 ##
# –webroot “$D” –issue -d “$DOM” –-ocsp-must-staple –keylength ec-384

4096 key

Subject a certificates in standalone mode

# DOM=””
# –issue –standalone -d “$DOM” –ocsp-must-staple –keylength 4096
## GET ecc cert too. Solely ec-384 or ec-256 ##
# –issue –standalone -d “$DOM” –ocsp-must-staple –keylength ec-384
The place,

–webroot /srv/www/htdocs : Specifies the net root folder for internet root mode. You could create /.well-known/acme-challenge/ within the root.–issue : Subject a certificates.-d domain-name : Specifies a site, used to situation, renew or revoke. We are able to use it a number of instances. For instance: –issue -d -d –ocsp-must-staple –keylength 4096–ocsp-must-staple : Generate ocsp should Staple extension–keylength 4096 : Specifies the area key size: 2048, 3072, 4096, 8192 or ec-256, ec-384, ec-521.–keylength ec-256 : Elliptic-curve cryptography (ECC) is an method to public-key cryptography based mostly on the algebraic construction of elliptic curves over finite fields. ECC permits smaller keys in comparison with non-EC cryptography (based mostly on plain Galois fields) to offer equal safety.

Step 6 – Configure Nginx on an OpenSUSE Linux server

Edit the config file:
# vi /and so forth/nginx/vhosts.d/
Replace as follows:

# http port 80 config
# https port 443 config

Pattern index.html

Create a brand new file as follows:
# vi /srv/www/htdocs/index.html
Append the next code:

<html lang=“en”>
<title>OpenSUSE.Cyberciti.Biz Nginx server</title>
<meta charset=“utf-Eight” />
<meta title=“viewport” content material=“width=device-width,”>

<h2>Howdy, World!</h2>
<p>It is a check server powerd by OpenSUSE Linux 15.2 and Nginx with free TLS certficate.</p>
E mail us <a href=“mailto:[email protected]>[email protected]</a>.

Howdy, World!

It is a check server powerd by OpenSUSE Linux 15.2 and Nginx with free TLS certficate.

E mail us [email protected].

Step 7 – Putting in Let’s Encrypt TLS certificates on OpenSUSE 15.1/15.2

Set up the issued cert to nginx server and reload the server:
# DOM=””
# -d “$DOM”
–reloadcmd “systemctl reload nginx”
–fullchain-file “/and so forth/nginx/ssl/$DOM.fullchain.cer”
–key-file “/and so forth/nginx/ssl/$DOM.key”
–cert-file “/and so forth/nginx/ssl/$DOM.cer”
Set up the ECC certificates too:
# -d “$DOM”
–reloadcmd “systemctl reload nginx”
–fullchain-file “/and so forth/nginx/ssl/$DOM.fullchain.cer.ecc”
–key-file “/and so forth/nginx/ssl/$DOM.key.ecc”
–cert-file “/and so forth/nginx/ssl/$DOM.cer.ecc”

How to Install and Set Up Lets Encrypt on OpenSUSE 15.1 or 15.2

Step Eight – Open TCP port 443 [HTTPS port]

It time to open HTTPS TCP port 443 utilizing firewllad on OpenSUSE Linux as follows:
# firewall-cmd –zone=public –add-service=https
# firewall-cmd –zone=public –add-service=https –permanent
# firewall-cmd –list-services
# curl -I

Step 9 – Take a look at it

SSL labs check:

OpenSUSE Linux Nginx SSL Labs A+ score
Safety headers check:
Security Headers A+ result
Fireplace an internet browser and kind your area similar to:
LetsEncrypt OpenSUSE Linux Nginx

Step 10 – Important instructions

We are able to checklist all certificates, run:
# –list

Main_Domain KeyLength SAN_Domains Created Renew “4096” no Mon Jul 6 19:07:07 UTC 2020 Fri Sep four 19:07:07 UTC 2020 “ec-384” no Mon Jul 6 19:11:54 UTC 2020 Fri Sep four 19:11:54 UTC 2020

Renew a cert for area named
# –renew -d
# –force –renew -d -d
Please observe that a cron job will attempt to do renewal a certificates for you too. That is put in by default as follows (no motion required in your half). To see cron job run:
# crontab -l

28 zero * * * “/root/”/ –cron –home “/root/” > /dev/null

Wish to improve shopper, execute:
# –upgrade
Getting assist is simple:
# –help | extra


We clarify methods to set up and arrange Let’s Encrypt TLS/SSL certificates in your OpenSUSE Linux 15.1/15.2 nginx based mostly server with OCSP Stapling and ECC certificates. See challenge residence web page right here for extra info.

This entry is 2 of 2 within the OpenSUSE Linux LEMP Stack Tutorial collection. Hold studying the remainder of the collection:Set up and use Nginx on OpenSUSE LinuxSecure Nginx with Let’s Encrypt on OpenSUSE Linux


Posted by: Vivek Gite

The creator is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the newest tutorials on SysAdmin, Linux/Unix and open supply matters through RSS/XML feed or weekly e-mail e-newsletter.


Please enter your comment!
Please enter your name here