How to Create a Trusted Self‑Signed SSL Certificate for Internal IP Access with OpenSSL and Nginx
This guide shows how to generate a self‑signed SSL certificate for an internal IP address using OpenSSL, configure Nginx to serve HTTPS without security warnings, and import the certificate into Chrome with the necessary extensions to avoid common name errors.
OpenSSL Self‑Signed Certificate
Install OpenSSL and create a directory for private keys.
yum install openssl openssl-devel -y
mkdir -pv /etc/ssl/privateGenerate a private key and CSR for the internal IP (e.g., 192.168.199.104).
cd /etc/ssl/private/
openssl req -new -newkey rsa:2048 -sha256 -nodes -out 192.168.199.104.csr -keyout 192.168.199.104.key -subj "/C=CN/ST=Beijing/L=Beijing/O=Super Inc./OU=Web Security/CN=192.168.199.104"
openssl x509 -req -days 365 -in 192.168.199.104.csr -signkey 192.168.199.104.key -out 192.168.199.104.crtCreate an extension file (http.ext) to add required usages and subject alternative names.
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @SubjectAlternativeName
[SubjectAlternativeName]
IP.1 = 127.0.0.1
IP.2 = 192.168.199.104Sign the certificate with the extension file.
openssl x509 -req -days 365 -in 192.168.199.104.csr -signkey 192.168.199.104.key -out 192.168.199.104.crt -extfile http.extConfigure Nginx to use the new certificate.
nginx -t
nginx -s reloadCopy the generated 192.168.199.104.crt to a Windows machine and import it into Chrome (Settings → Privacy & Security → Manage certificates → Import).
Because Chrome may reject the certificate, delete any previously imported version, then add the extension file (http.ext) to the certificate store so Chrome recognises the IP as a valid subject alternative name.
After re‑importing the updated certificate, reload Nginx and clear Chrome’s cache before accessing the site.
Summary
Chrome requires an additional extension file (http.ext) that defines keyUsage, extendedKeyUsage, and subjectAltName for the internal IP.
Two commands generate the key/CSR and sign the certificate with the extension.
Import the resulting .crt into Chrome’s trusted root store.
Reload Nginx and clear browser cache to complete the setup.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
