Import a new Root CA and Replace Digital Certificates (NGINX – Internal Reverse Proxy)
File extension: .crt
Encoding: PEM (Base64, begins with -----BEGIN CERTIFICATE-----)
If your cert is .cer or .pem, that’s fine — Debian treats them the same once placed correctly.
All actions below to be executed as root
cp my-root-ca.crt /usr/local/share/ca-certificates/
Important notes
Use /usr/local/share/ca-certificates/ for custom / internal CAs
Filename must end in .crt
Do not place custom certs directly in /etc/ssl/certs
Execute:
update-ca-certificates
Expected output:
Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
cp -a /etc/nginx/sites-available/grafana.conf /etc/nginx/sites-available/grafana.conf_saved
-a preserves perms/ownership/timestamps (good practice for config backups).
On Debian, convention is:
certs in /etc/ssl/certs/
private keys in /etc/ssl/private/ (should be root-only readable)
cp -a mynewcert.pem /etc/ssl/certs/mynewcert.pem
cp -a mynewcertkey.pem /etc/ssl/private/mynewcertkey.pem
chown root:root /etc/ssl/private/mynewcertkey.pem
chmod 600 /etc/ssl/private/mynewcertkey.pem
(Leave the cert file readable; the key should not be.)
Open the file:
nano /etc/nginx/sites-available/grafana.conf
Change these two lines:
ssl_certificate /etc/ssl/certs/mynewcert.pem;
ssl_certificate_key /etc/ssl/private/mynewcertkey.pem;
Save/exit.
nginx -t
You want:
syntax is ok
test is successful
systemctl reload nginx
systemctl restart nginx
systemctl status nginx --no-pager
Was this article helpfu?
Thank you for voting
You are related to multiple companies. Please select the company you wish to login as.