Kalyani Kenekar: Securing Your Website: Installing and Configuring Nginx with SSL
The Initial Encounter:
I recently started to work with Nginx to explore the requirements on how to
configure a then so called server block. It s quite different than within
Apache. But there are a tons of good websites out there which do explain the
different steps and options quite well. I also realized quickly that I need to
be able to configure my Nginx setups in a way so the content is delivered
through https with some automatic redirection from http URLs.
- Let s install Nginx
Installing Nginx
$ sudo apt update
$ sudo apt install nginx
Checking your Web Server
- We can check now nginx service is active or inactive
Output
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2024-02-12 09:59:20 UTC; 3h ago
Docs: man:nginx(8)
Main PID: 2887 (nginx)
Tasks: 2 (limit: 1132)
Memory: 4.2M
CPU: 81ms
CGroup: /system.slice/nginx.service
2887 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
2890 nginx: worker process
- Now we successfully installed nginx and it in running state.
How To Secure Nginx with Let s Encrypt on Debian 12
- In this documentation, you will use Certbot to obtain a free SSL certificate
for Nginx on Debian 12 and set up your certificate.
Step 1 Installing Certbot
$ sudo apt install certbot python3-certbot-nginx
- Certbot is now ready to use, but in order for it to automatically configure
SSL for Nginx, we need to verify some of Nginx s configuration.
Step 2 Confirming Nginx s Configuration
- Certbot needs to be able to find the correct server block in your Nginx
configuration for it to be able to automatically configure SSL. Specifically,
it does this by looking for a server_name directive that matches the domain you
request a certificate for. To check, open the configuration file for your
domain using nano or your favorite text editor.
$ sudo vi /etc/nginx/sites-available/example.com
server
listen 80;
root /var/www/html/;
index index.html;
server_name example.com
location /
try_files $uri $uri/ =404;
location /test.html
try_files $uri $uri/ =404;
auth_basic "admin area";
auth_basic_user_file /etc/nginx/.htpasswd;
- Fillup above data your project wise and then save the file, quit your editor,
and verify the syntax of your configuration edits.
$ sudo nginx -t
Step 3 Obtaining an SSL Certificate
- Certbot provides a variety of ways to obtain SSL certificates through
plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading
the config whenever necessary. To use this plugin, type the following command
line.
$ sudo certbot --nginx -d example.com
- The configuration will be updated, and Nginx will reload to pick up the new
settings. certbot will wrap up with a message telling you the process was
successful and where your certificates are stored.
Output
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2024-05-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
- Your certificates are downloaded, installed, and loaded. Next check the
syntax again of your configuration.
$ sudo nginx -t
- If you get an error, reopen the server block file and check for any typos or
missing characters. Once your configuration file s syntax is correct, reload
Nginx to load the new configuration.
$ sudo systemctl reload nginx
- Try reloading your website using https:// and notice your browser s security
indicator. It should indicate that the site is properly secured, usually with
a lock icon.
Now your website is secured by SSL usage.
$ sudo apt update
$ sudo apt install nginx
Checking your Web Server
- We can check now nginx service is active or inactive
Output
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2024-02-12 09:59:20 UTC; 3h ago
Docs: man:nginx(8)
Main PID: 2887 (nginx)
Tasks: 2 (limit: 1132)
Memory: 4.2M
CPU: 81ms
CGroup: /system.slice/nginx.service
2887 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
2890 nginx: worker process
- Now we successfully installed nginx and it in running state.
How To Secure Nginx with Let s Encrypt on Debian 12
- In this documentation, you will use Certbot to obtain a free SSL certificate
for Nginx on Debian 12 and set up your certificate.
Step 1 Installing Certbot
$ sudo apt install certbot python3-certbot-nginx
- Certbot is now ready to use, but in order for it to automatically configure
SSL for Nginx, we need to verify some of Nginx s configuration.
Step 2 Confirming Nginx s Configuration
- Certbot needs to be able to find the correct server block in your Nginx
configuration for it to be able to automatically configure SSL. Specifically,
it does this by looking for a server_name directive that matches the domain you
request a certificate for. To check, open the configuration file for your
domain using nano or your favorite text editor.
$ sudo vi /etc/nginx/sites-available/example.com
server
listen 80;
root /var/www/html/;
index index.html;
server_name example.com
location /
try_files $uri $uri/ =404;
location /test.html
try_files $uri $uri/ =404;
auth_basic "admin area";
auth_basic_user_file /etc/nginx/.htpasswd;
- Fillup above data your project wise and then save the file, quit your editor,
and verify the syntax of your configuration edits.
$ sudo nginx -t
Step 3 Obtaining an SSL Certificate
- Certbot provides a variety of ways to obtain SSL certificates through
plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading
the config whenever necessary. To use this plugin, type the following command
line.
$ sudo certbot --nginx -d example.com
- The configuration will be updated, and Nginx will reload to pick up the new
settings. certbot will wrap up with a message telling you the process was
successful and where your certificates are stored.
Output
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2024-05-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
- Your certificates are downloaded, installed, and loaded. Next check the
syntax again of your configuration.
$ sudo nginx -t
- If you get an error, reopen the server block file and check for any typos or
missing characters. Once your configuration file s syntax is correct, reload
Nginx to load the new configuration.
$ sudo systemctl reload nginx
- Try reloading your website using https:// and notice your browser s security
indicator. It should indicate that the site is properly secured, usually with
a lock icon.
Now your website is secured by SSL usage.
Output
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2024-02-12 09:59:20 UTC; 3h ago
Docs: man:nginx(8)
Main PID: 2887 (nginx)
Tasks: 2 (limit: 1132)
Memory: 4.2M
CPU: 81ms
CGroup: /system.slice/nginx.service
2887 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
2890 nginx: worker process
- In this documentation, you will use Certbot to obtain a free SSL certificate for Nginx on Debian 12 and set up your certificate.
Step 1 Installing Certbot
$ sudo apt install certbot python3-certbot-nginx
- Certbot is now ready to use, but in order for it to automatically configure
SSL for Nginx, we need to verify some of Nginx s configuration.
Step 2 Confirming Nginx s Configuration
- Certbot needs to be able to find the correct server block in your Nginx
configuration for it to be able to automatically configure SSL. Specifically,
it does this by looking for a server_name directive that matches the domain you
request a certificate for. To check, open the configuration file for your
domain using nano or your favorite text editor.
$ sudo vi /etc/nginx/sites-available/example.com
server
listen 80;
root /var/www/html/;
index index.html;
server_name example.com
location /
try_files $uri $uri/ =404;
location /test.html
try_files $uri $uri/ =404;
auth_basic "admin area";
auth_basic_user_file /etc/nginx/.htpasswd;
- Fillup above data your project wise and then save the file, quit your editor,
and verify the syntax of your configuration edits.
$ sudo nginx -t
Step 3 Obtaining an SSL Certificate
- Certbot provides a variety of ways to obtain SSL certificates through
plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading
the config whenever necessary. To use this plugin, type the following command
line.
$ sudo certbot --nginx -d example.com
- The configuration will be updated, and Nginx will reload to pick up the new
settings. certbot will wrap up with a message telling you the process was
successful and where your certificates are stored.
Output
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2024-05-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
- Your certificates are downloaded, installed, and loaded. Next check the
syntax again of your configuration.
$ sudo nginx -t
- If you get an error, reopen the server block file and check for any typos or
missing characters. Once your configuration file s syntax is correct, reload
Nginx to load the new configuration.
$ sudo systemctl reload nginx
- Try reloading your website using https:// and notice your browser s security
indicator. It should indicate that the site is properly secured, usually with
a lock icon.
Now your website is secured by SSL usage.
- Certbot needs to be able to find the correct server block in your Nginx configuration for it to be able to automatically configure SSL. Specifically, it does this by looking for a server_name directive that matches the domain you request a certificate for. To check, open the configuration file for your domain using nano or your favorite text editor.
$ sudo vi /etc/nginx/sites-available/example.com
server
listen 80;
root /var/www/html/;
index index.html;
server_name example.com
location /
try_files $uri $uri/ =404;
location /test.html
try_files $uri $uri/ =404;
auth_basic "admin area";
auth_basic_user_file /etc/nginx/.htpasswd;
- Fillup above data your project wise and then save the file, quit your editor, and verify the syntax of your configuration edits.
$ sudo nginx -t
Step 3 Obtaining an SSL Certificate
- Certbot provides a variety of ways to obtain SSL certificates through
plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading
the config whenever necessary. To use this plugin, type the following command
line.
$ sudo certbot --nginx -d example.com
- The configuration will be updated, and Nginx will reload to pick up the new
settings. certbot will wrap up with a message telling you the process was
successful and where your certificates are stored.
Output
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2024-05-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
- Your certificates are downloaded, installed, and loaded. Next check the
syntax again of your configuration.
$ sudo nginx -t
- If you get an error, reopen the server block file and check for any typos or
missing characters. Once your configuration file s syntax is correct, reload
Nginx to load the new configuration.
$ sudo systemctl reload nginx
- Try reloading your website using https:// and notice your browser s security
indicator. It should indicate that the site is properly secured, usually with
a lock icon.
Now your website is secured by SSL usage.
Output
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2024-05-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
Like each month, have a look at the work funded by
Here comes the 2nd article of the 5-episode blog post series written by Guido Berh rster, member of staff at my company Fre(i)e Software GmbH.
Enjoy also this read on Guido's work on Polis,
My Debian contributions this month were all
A short status update of what happened on my side last month. Was able
to test our Cellbroadcast bits, feedbackd became more flexible
regarding LEDs, Phosh 0.40 is out, and some more.
Phosh
It s been a while since I played with something new been stuck in a bit of a
rut with radios recently - working on refining and debugging stuff I mostly
understand for the time being. The other day, I was out getting some food and I
idly wondered how the restaurant pager system worked. Idle curiosity gave way
to the realization that I, in fact, likely had the means and ability to answer
this question, so I bought the first set of the most popular looking restaurant
pagers I could find on eBay, figuring it d be a fun multi-week adventure.
Not just similar identical. The only major difference was the baud rate and
bit structure of the packets, and the only minor difference was the existence
of what I think is a wakeup preamble packet (of all zeros), rather than a
preamble symbol that lasted longer than usual PHY symbol (which makes this
pager system a bit easier to work with than my tree, IMHO).
Getting down to work, I took some measurements to determine what the symbol
duration was over the course of a few packets, I was able to determine the
symbol rate was somewhere around
Once I got here, I wrote a quick and dirty modulator, and was able to ring up
pagers! Unmitigated success and good news only downside was that it took me
a single night, and not the multi-week adventure I was looking for. Well, let s
finish the job and document what we ve found for the sake of completeness.












A new version of the