Install Namecheap SSL on Nginx: Combine CRT and CA-Bundle

by Fahim Mahmud Chisti

To install a Namecheap SSL certificate on Nginx, combine your domain’s CRT file and the CA-bundle into one file, domain certificate first. Then point Nginx at that file and the private key from your CSR, and reload. Skipping the bundle is why curl, API clients and many phones report an untrusted certificate while your desktop browser looks fine. At the end you will have a complete, verified chain.

Quick answer: Nginx needs your certificate and the CA-bundle in a single file, with your domain certificate on top. Combine them with cat, point ssl_certificate at the combined file and ssl_certificate_key at your private key, then test and reload.

  1. Upload your .crt and .ca-bundle files from Namecheap to the server.
  2. Combine them, domain certificate first: cat example_com.crt example_com.ca-bundle into example_com_chained.crt.
  3. Check that the key matches the certificate (the two modulus hashes must be identical).
  4. Set ssl_certificate to the chained file and ssl_certificate_key to your key.
  5. Run sudo nginx -t, reload, and confirm the chain with openssl s_client.
In this guide
  1. Before You Start
  2. What Namecheap Sends You in the SSL Zip File
  3. Generate the Private Key and CSR (If Starting Fresh)
  4. Combine CRT and CA-Bundle in the Exact Right Order
  5. Verify the Certificate Chain and Match the Private Key
  6. Configure Nginx to Serve the Namecheap SSL Bundle
  7. If It Still Doesn’t Work: Common Errors
  8. Enable OCSP Stapling and Security Headers
  9. Test Your SSL Configuration with OpenSSL and SSL Labs
  10. Frequently Asked Questions
  11. Next Steps
Terminal screen showing OpenSSL certificate chain verification for Nginx SSL setup

Before You Start

  • Server access: SSH with sudo on the Nginx server that answers for the domain.
  • The private key: the key created together with your CSR (certificate signing request). Namecheap never receives it. If it is lost, generate a new key and CSR (next sections) and reissue the certificate in your Namecheap account.
  • The certificate files: the zip Namecheap provides once domain validation is complete.
  • Shared hosting instead? If the site runs on Hostinger shared hosting rather than your own Nginx server, follow our guide to installing a Namecheap SSL certificate on Hostinger instead.
  • Time and rollback: about 15–20 minutes. Copy your current site file and any existing certificate files before replacing them, and run sudo nginx -t before every reload. A wrong path or mismatched key stops the new config from loading.

What Namecheap Sends You in the SSL Zip File

Once your SSL validation passes (either via DNS CNAME or HTTP file upload), Namecheap sends over a zip file or gives you a download button in their dashboard. When you unzip it, you usually see two files:

  • your_domain_name.crt: Your primary server certificate, issued specifically to your domain or subdomain.
  • your_domain_name.ca-bundle: The intermediate and root certs that bridge trust between your cert and a recognized root authority like Sectigo or Comodo.

Older archives sometimes included four separate files: your_domain.crt, SectigoRSADomainValidationSecureServerCA.crt, USERTrustRSAAddTrustCA.crt, and AddTrustExternalCARoot.crt. Modern Namecheap downloads pack those intermediate layers into a single .ca-bundle file so you don’t have to guess the order of three loose certs.

The commands below call the files example_com.crt and example_com.ca-bundle. Use your own file names, or rename the files to match.

Generate the Private Key and CSR (If Starting Fresh)

If you already have the private key from when you generated your CSR, skip this step. If you’re starting from scratch or reissuing, run this on the server to create a 2048-bit RSA key and a CSR with OpenSSL:

sudo openssl req -new -newkey rsa:2048 -nodes -keyout /etc/ssl/private/example_com.key -out /etc/ssl/certs/example_com.csr

OpenSSL will prompt for your Country, State, Locality, Organization Name, and Common Name. For Common Name, enter your exact domain or subdomain (like example.com or app.example.com). Then print the CSR with sudo cat /etc/ssl/certs/example_com.csr and paste the whole block, including the BEGIN and END lines, into Namecheap when you activate or reissue the certificate.

The key belongs in /etc/ssl/private, not in the world-readable /etc/ssl/certs. Lock down permissions on your private key immediately so other system users can’t read it:

sudo chmod 600 /etc/ssl/private/example_com.key

Combine CRT and CA-Bundle in the Exact Right Order

Nginx’s ssl_certificate directive expects a chained bundle where your server certificate sits at the very top, followed immediately by the intermediate certificates. If you invert this order, Nginx refuses to load the configuration with a key values mismatch error, because it tries to pair your private key with the first certificate in the file (the intermediate) instead of your domain cert.

Upload your_domain_name.crt and your_domain_name.ca-bundle to /etc/ssl/certs/ on your server (with scp or SFTP). Then, on the server, merge them into a single chained file with cat:

cd /etc/ssl/certs
# Combine domain CRT first, CA-bundle second
cat example_com.crt example_com.ca-bundle | sudo tee example_com_chained.crt > /dev/null

If your archive contains individual intermediate files instead of a single bundle, concatenate them in issuing order: domain cert first, then the intermediate that signed it, then the next one up. Leave the self-signed root out (the AddTrust root from the old four-file archives expired in 2020):

cat example_com.crt intermediate1.crt intermediate2.crt | sudo tee example_com_chained.crt > /dev/null

Quick check: grep -c "BEGIN CERTIFICATE" example_com_chained.crt prints how many certificates the file holds. It should be your certificate plus the intermediates, so 2 or more; 1 means the bundle was not added.

Then open example_com_chained.crt in an editor and look at the boundary lines. There must be a clean newline separating the end of your cert and the start of the next one:

-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----

If you see -----END CERTIFICATE----------BEGIN CERTIFICATE----- glued together on a single line, add a newline between them. That missing linebreak is one of the most common reasons Nginx fails to load the certificate with a PEM bad end line error on reload.

Verify the Certificate Chain and Match the Private Key

Before touching your Nginx configuration, verify two things on the CLI: that your combined certificate actually matches your private key, and that the intermediate chain validates cleanly.

Compare the MD5 hashes of the modulus for both your key and the chained cert. They must match word-for-word:

openssl x509 -noout -modulus -in /etc/ssl/certs/example_com_chained.crt | openssl md5
sudo openssl rsa -noout -modulus -in /etc/ssl/private/example_com.key | openssl md5

If both commands return the exact same hash (like (stdin)= a1b2c3d4e5f6…), your keypair matches. If they differ, the CRT was issued against a different CSR/private key than the one on disk.

Next, test the intermediate trust chain with OpenSSL:

openssl verify -untrusted /etc/ssl/certs/example_com.ca-bundle /etc/ssl/certs/example_com.crt

If the chain is built properly, OpenSSL prints example_com.crt: OK.

Configure Nginx to Serve the Namecheap SSL Bundle

With the bundle and key verified, open your Nginx server block (usually at /etc/nginx/sites-available/example.com on Debian/Ubuntu systems).

Add a port 80 block to force HTTPS, and update your port 443 block to point directly to example_com_chained.crt and example_com.key. If the domain already has a 443 block, change only its ssl_certificate and ssl_certificate_key lines rather than adding a second block for the same names:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    # Enforce HTTPS redirect
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com www.example.com;
    root /var/www/example.com/public;
    index index.html;
    # Chained Certificate and Private Key
    ssl_certificate /etc/ssl/certs/example_com_chained.crt;
    ssl_certificate_key /etc/ssl/private/example_com.key;
    # TLS Protocols and Ciphers
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
    ssl_prefer_server_ciphers on;
    # Session Cache for Handshake Performance
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1d;
    ssl_session_tickets off;
    location / {
        try_files $uri $uri/ =404;
    }
}

Always test your syntax before reloading the service. If the test fails, the running site keeps its old certificate until you fix the error:

sudo nginx -t

Once you get syntax is ok and test is successful, reload Nginx. On Nginx 1.25.1 and newer, a warning that listen ... http2 is deprecated is harmless; the config still loads:

sudo systemctl reload nginx

If It Still Doesn’t Work: Common Errors

These are the most common errors with Namecheap certificates on Nginx. Two more appear earlier: key values mismatch (files combined in the wrong order, or the wrong key) and PEM bad end line (a missing newline between certificates).

1. The “SSL_ERROR_RX_RECORD_TOO_LONG” Error

This error means a client sent an HTTPS request to a port where Nginx is listening for plain HTTP. Check your 443 server block and verify you have the ssl parameter on the listen directive:

# Broken:
listen 443;
# Fixed:
listen 443 ssl;

2. Redirect Loops Behind Cloudflare or Reverse Proxies

If traffic flows through an edge proxy or CDN before reaching your server, mismatched SSL modes between the proxy and Nginx can trigger infinite redirect loops. If you run into that loop, see our guide on how to fix SSL ERR_TOO_MANY_REDIRECTS on Nginx behind a CDN.

3. SEC_ERROR_UNKNOWN_ISSUER on Firefox and Android

If Chrome on your laptop opens the site fine but Firefox or a phone screams about an untrusted issuer, you pointed ssl_certificate to example_com.crt instead of example_com_chained.crt. Browsers can hide the problem because they reuse intermediates already received from other sites; curl and most HTTP libraries only trust what your server actually sends. Pointing Nginx to the combined bundle fixes this immediately.

Enable OCSP Stapling and Security Headers

OCSP stapling speeds up the initial TLS handshake. Instead of forcing every visitor’s browser to reach out to Sectigo to check revocation status, Nginx queries Sectigo periodically, caches the signed proof, and hands it straight to the browser during the handshake.

Drop these directives into your port 443 block:

# OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/ssl/certs/example_com_chained.crt;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;
# Security Headers
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Frame-Options DENY always;
add_header X-Content-Type-Options nosniff always;

Only add includeSubDomains and preload to the HSTS header once every subdomain serves HTTPS; browsers remember the policy, and leaving the preload list takes months.

Run sudo nginx -t and reload after saving. If nginx -t warns that "ssl_stapling" ignored, no OCSP responder URL in the certificate, your certificate does not offer OCSP; the site still works, and you can remove the stapling lines. For more details on TLS settings, check the Nginx HTTP SSL Module documentation.

Test Your SSL Configuration with OpenSSL and SSL Labs

Don’t rely on your everyday browser to verify an SSL setup, since it may already have the intermediates cached. Run a direct handshake test from your own computer’s terminal with OpenSSL’s s_client (press Ctrl+C to exit):

openssl s_client -connect example.com:443 -servername example.com

Check the certificate chain section near the top of the output. For a Sectigo DV certificate issued since mid-2025 it looks like this (older ones show different CA names):

Certificate chain
 0 s:CN = example.com
   i:C = GB, O = Sectigo Limited, CN = Sectigo Public Server Authentication CA DV R36
 1 s:C = GB, O = Sectigo Limited, CN = Sectigo Public Server Authentication CA DV R36
   i:C = GB, O = Sectigo Limited, CN = Sectigo Public Server Authentication Root R46
 2 s:C = GB, O = Sectigo Limited, CN = Sectigo Public Server Authentication Root R46
   i:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority

You should see level 0 (your domain) followed by the intermediate certificates from the CA bundle. If it cuts off at 0, your CA-bundle wasn’t merged or loaded properly.

Finally, run your domain through the Qualys SSL Labs Server Test to confirm the chain is reported as complete and no weak ciphers are active.

Frequently Asked Questions

Do I need to include the root certificate in the CA-bundle for Nginx?

No. Clients only trust the root CAs in their own store, so a root sent by the server just adds bytes to every handshake. Use the .ca-bundle exactly as Namecheap ships it; it contains the intermediates in the right order.

Can I use Certbot to automate Namecheap SSL renewals?

No. Paid Namecheap certificates such as PositiveSSL are renewed by reissuing and validating them in your account, not through Certbot. Since March 2026 publicly trusted certificates last at most 200 days (100 days from March 2027), so expect to repeat these steps at least twice a year. For hands-off renewal, see our guide on setting up Let’s Encrypt wildcard SSL with Certbot DNS-01 on Nginx.

Where is the private key for my Namecheap SSL certificate?

On the machine where you generated the CSR, not in the Namecheap zip. If you followed this guide, it is /etc/ssl/private/example_com.key. If the key is lost, the certificate cannot be used: generate a new key and CSR, reissue the certificate from your Namecheap account and install the new files.

How long does Namecheap SSL validation take?

For domain-validated (DV) certificates, it is usually quick once the certificate authority can see your DNS CNAME record or HTTP validation file. A DNS record that hasn’t propagated yet is the usual cause of delays. When the certificate shows as issued in your Namecheap account, download the files and chain them using the steps above.

Next Steps

Note the certificate’s expiry date (openssl x509 -noout -enddate -in /etc/ssl/certs/example_com.crt) and set a reminder a few weeks before it, because paid certificates have to be reinstalled by hand. To make sure only the authorities you use can issue certificates for your domain, add CAA records as shown in our guide to configuring CAA records in Namecheap DNS.

all_in_one_marketing_tool