Generate an SSL Certificate with OpenSSL
openssl req and give the CSR to a CA. For local testing, openssl req -x509 makes a self-signed certificate in one step. Always include a Subject Alternative Name.Generate an SSL certificate: key and CSR with OpenSSL
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out private.key
openssl req -new -key private.key -out request.csr \
-subj "/CN=example.com" \
-addext "subjectAltName=DNS:example.com,DNS:www.example.com"
Submit request.csr to the CA. Keep private.key secret and never send it. If you prefer a form, use the CSR Generator or the OpenSSL command generator.
For ECDSA instead of RSA:
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out private.key
Option B: Self-signed certificate for testing
openssl req -x509 -newkey rsa:2048 -nodes -days 365 \
-keyout selfsigned.key -out selfsigned.crt \
-subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
Browsers will warn about it because no trusted CA signed it. Use it for local development and internal tests only. For anything public, use a trusted certificate. A free one is available at TryFreeSSL.com.
Which one do you need?
| Goal | Use |
|---|---|
| Public website | Key and CSR, or an ACME client that handles both |
| Local development | Self-signed or a local development CA |
| Internal service | Private CA, with its root installed on clients |
Generate an SSL certificate: verify it with OpenSSL
openssl req -in request.csr -noout -text -verify
openssl x509 -in selfsigned.crt -noout -subject -dates -ext subjectAltName
Check that the names, key size and dates are what you expect. To make sure a certificate and key belong together, see Check If a Certificate Matches Its Private Key.
Key handling tips
- Restrict permissions:
chmod 600 private.key. - Do not commit keys to version control.
- Use one key per certificate where practical, and generate a new key at renewal if your process allows it.
- RSA 2048 and ECDSA P-256 are common, widely supported choices.
Install it
Point your server at the certificate and key files, reload, and test with the SSL Checker. Convert formats if needed with the SSL Converter.
Related reading: the CSR generator, decoding the CSR before you submit and a certificate for a domain with no host.
Frequently Asked Questions
Why do I need a SAN?
Modern browsers match the hostname against the Subject Alternative Name, not the Common Name alone.
Can a self-signed certificate be trusted?
Only on machines where you install it as trusted. The public will see a warning.
What does -nodes do?
It writes the private key without a passphrase. Convenient for servers, but protect the file.
Do I need the CSR after issuance?
No, but keep the private key. Without it the certificate is useless.
Can OpenSSL issue a certificate browsers trust?
No. OpenSSL can sign a certificate with your own key, but browsers only trust authorities in their root store. Use the self-signed option for testing on your own machines.
What is a SAN and do I need one?
Subject Alternative Names are the list of hostnames a certificate covers. Browsers read that list, not the older common name field, so a certificate without a SAN fails on every name.
Should I use RSA or ECDSA?
RSA 2048 is accepted everywhere. ECDSA P-256 is smaller and faster, and works on current browsers and servers, but check any old client that still connects before you switch. Whichever you pick, keep the key file private and never paste it into a website.
How do I check the certificate matches the key?
Compare the modulus of both files: openssl x509 -noout -modulus -in cert.pem and openssl rsa -noout -modulus -in key.pem. If the two hashes differ, the files do not belong together and the server will refuse to start.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.