NGINX with Self-Signed Certificate on Docker
<p>While working with our code, we often need to quickly check if something works under HTTPS — or more importantly, how it behaves under HTTPS. There are plenty of guides online showing you how to create a Certificate Sign Request (CSR), how to self-sign that CSR, and how to manually modify your web server’s configuration to make it use that certificate.</p>
<p>In this article, I will present a fully-automated process using Docker to quickly spin up an NGINX container with a self-signed certificate — all without having to generate or manually edit anything at all!</p>
<h1>Security note and warning</h1>
<ol>
<li>A self-signed certificate can only be trusted by… you. It is not a means to serve data in a production environment; use a proper certificate in such cases.</li>
<li>The NGINX configuration to serve content under HTTPS presented in this article is the bare minimum to get the job done. If you want to modify a production NGINX with TLS, please consult the <a href="https://docs.nginx.com/nginx/admin-guide/security-controls/terminating-ssl-http/" rel="noopener ugc nofollow" target="_blank">official guide</a>.</li>
</ol>
<p>If you are just starting with Public Key Cryptography, I have <a href="https://betterprogramming.pub/an-introduction-to-public-key-cryptography-3ea0cf7bf4ba" rel="noopener ugc nofollow" target="_blank">written an introduction article</a> you might find useful.</p>
<p><a href="https://betterprogramming.pub/nginx-self-signed-certificate-docker-f3861c0f03e"><strong>Click Here</strong></a></p>