Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To rekey an SSL certificate on Apache running Ubuntu, generate a new private key and CSR, obtain a newly signed certificate containing every required hostname, install the certificate and intermediate chain, point the correct HTTPS VirtualHost at the new files, verify that the certificate matches the new key, and reload Apache. Keep the old key, certificate, and configuration available until the replacement has been tested in production.

The procedure below covers both a manually issued certificate and an ACME deployment managed by Certbot, including the checks that prevent the most common Apache start-up failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What rekeying changes

Rekeying is more than renewing an expiry date. A rekey creates a new private key and a new certificate-signing request (CSR). A certificate authority signs a certificate for that CSR, so the resulting certificate contains a different public key from the one in the old certificate. Apache must then be configured to use the new certificate and its matching private key.

If you only obtain another certificate for the existing key, you have reissued or renewed the certificate, not rekeyed it. Rekeying is appropriate after a suspected key exposure, when changing key parameters, or when your certificate authority requires a fresh key for a replacement certificate.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Before you touch Apache

Confirm access and ownership

  • Use an account with sudo access on the Ubuntu server.
  • Identify every DNS name the service must answer, such as example.com and www.example.com. Modern certificates validate Subject Alternative Names (SANs); do not rely on the Common Name alone for hostname coverage.
  • Know which certificate authority will sign the CSR. A manual CA workflow and an ACME workflow have different issuance and renewal steps.
  • Schedule a short change window if the key is encrypted and Apache requires an interactive passphrase during a restart.

Preserve a rollback set

Copy the current certificate, private key, chain file, and the relevant Apache site configuration to a root-owned backup location before generating anything. Keep the new key in a separate filename until issuance and verification are complete. Private keys should not be placed in a user home directory with broad read permissions.

Ubuntu commonly stores public certificates under /etc/ssl/certs and private keys under /etc/ssl/private. Certbot-managed material normally remains under /etc/letsencrypt/live/<domain>/. The exact paths in your enabled VirtualHost are authoritative.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Inventory the active HTTPS VirtualHost

Apache can have several port-443 VirtualHosts, and editing the wrong one is a frequent cause of apparently unchanged certificates. First ask Apache which names and files are enabled:

sudo apache2ctl -S
sudo grep -R "SSLCertificate" /etc/apache2/sites-enabled/
sudo grep -R "<VirtualHost .*:443" /etc/apache2/sites-enabled/

Open the VirtualHost that serves the hostname you will test. Record its ServerName, ServerAlias, SSLCertificateFile, SSLCertificateKeyFile, and any chain directive. Back up that site file and note whether it is a symlink from sites-available into sites-enabled.

Do not assume that the first certificate found by a recursive search is active. The name supplied through the TLS Server Name Indication (SNI) request selects a VirtualHost, so the test hostname, the certificate SAN, and the edited VirtualHost must all agree.

2. Generate a new private key and CSR

Use a protected working directory

Create the key where only root can read it, or set a restrictive umask before running OpenSSL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo -i
umask 077
mkdir -p /root/tls-rekey-example.com
cd /root/tls-rekey-example.com

The traditional RSA example documented by Apache is:

openssl genrsa -des3 -out server.key 2048
openssl req -new -key server.key -out server.csr

genrsa -des3 encrypts the private key with a passphrase. When OpenSSL asks for the CSR Common Name, enter the server’s fully qualified domain name (FQDN), as Apache’s SSL/TLS FAQ advises. The CA’s request form or configuration must also include every required DNS name as a SAN. For example, a certificate intended for both example.com and www.example.com must list both names, not just one of them.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

On OpenSSL versions that support -addext, SANs can be supplied directly while creating the CSR:

openssl req -new -key server.key -out server.csr 
  -subj "/C=GB/ST=England/L=London/O=Example Ltd/CN=example.com" 
  -addext "subjectAltName=DNS:example.com,DNS:www.example.com"

If that option is unavailable, use the CA’s documented CSR configuration or web form to request SANs. Inspect the finished CSR before submitting it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
openssl req -in server.csr -noout -subject -text

Keep server.key secret and send only server.csr to the certificate authority. Never email or upload the private key as part of a certificate request.

Passphrase trade-off

An encrypted key reduces the impact of a stolen key file, but Apache may need the passphrase whenever the service starts. Apache warns that “Removing the pass-phrase removes a layer of security from your server – proceed with caution!” Ubuntu similarly describes an unattended service without a passphrase as convenient but insecure because compromise of the key compromises the server. If unattended startup requires an unencrypted key, restrict it to root with mode 600, keep an encrypted backup offline, and protect the server itself.

3. Obtain the newly signed certificate

Manual certificate-authority issuance

Submit server.csr through the chosen CA’s issuance process. Complete any required domain-control validation, then download the server certificate and the intermediate certificate or chain file. Confirm that the issued certificate contains the same SAN set you requested and that its public key corresponds to the new CSR.

ACME issuance with Certbot

For a conventional Apache site, Ubuntu documents this command:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo certbot --apache -d example.com -d www.example.com

Pass every required hostname explicitly. Certbot’s Apache plugin locates the matching VirtualHost, typically in /etc/apache2/sites-enabled/, adds the necessary TLS directives, and reloads Apache. In a nonstandard topology, use the CA’s documented DNS-01 challenge or a centralized ACME workflow; DNS-01 may require access to the DNS provider’s API and is commonly used when the server cannot answer an HTTP challenge.

Certbot stores the managed files beneath /etc/letsencrypt/live/<domain>/. In that layout, fullchain.pem contains the server certificate followed by its intermediate certificates, while privkey.pem is the private key. Reference the paths Certbot supplies instead of copying files into a second location that automated renewal will not update.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Manual CA or Certbot: which workflow fits?

Decision point Manual CSR and CA issuance Certbot with ACME
Issuance You generate and submit a CSR, complete the CA’s validation, and install the returned files. Certbot requests a certificate and completes an ACME challenge, often through the Apache plugin.
Hostname coverage You select SANs in the CA request and must verify the issued names. Every required name is passed with a -d option; wildcard certificates generally require a DNS-01 workflow.
Renewal You track expiry, create replacement CSRs when required, and schedule installation yourself. Certbot can automate renewal; test the renewal path with sudo certbot renew --dry-run.
File layout Common system paths are /etc/ssl/certs for certificates and /etc/ssl/private for keys, subject to your configuration. Managed files are under /etc/letsencrypt/live/<domain>/, including fullchain.pem and privkey.pem.
Reload behavior You run apache2ctl configtest and reload or restart Apache after installing files. The Apache plugin writes directives and reloads during issuance; a deployment hook can be used when your topology needs a separate reload.
DNS or API access Usually limited to the CA validation method you select. HTTP challenges can work through Apache; DNS-01 requires control of the relevant DNS zone or its API.
Private-key control You create and retain the key locally and send the CA only the CSR. Certbot also generates and stores the key locally, but its permissions and renewal automation must be included in your operational controls.

4. Install the certificate, key, and chain

Manually issued files

Place the files in protected locations, preserving ownership and modes. Adapt the source names to the files returned by your CA:

sudo install -o root -g root -m 644 new.crt /etc/ssl/certs/example.com.crt
sudo install -o root -g root -m 600 new.key /etc/ssl/private/example.com.key
sudo install -o root -g root -m 644 issuer-chain.pem /etc/ssl/certs/issuer-chain.pem

In the HTTPS VirtualHost, use the new paths:

SSLCertificateFile /etc/ssl/certs/example.com.crt
SSLCertificateKeyFile /etc/ssl/private/example.com.key
# Use this only when your Apache configuration expects a separate chain file:
SSLCertificateChainFile /etc/ssl/certs/issuer-chain.pem

Apache’s documented primary directives are SSLCertificateFile and SSLCertificateKeyFile. Depending on Apache version and configuration, the intermediate certificates may be supplied separately with SSLCertificateChainFile or appended after the server certificate in a full-chain file. Follow the syntax supported by the installed Apache package; do not append an unrelated root certificate merely to make a file longer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Certbot-managed files

Point Apache at the paths in the domain’s Certbot directory, for example:

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

fullchain.pem already combines the leaf certificate and intermediate certificates. Do not replace it with only the leaf certificate, or clients that do not already cache the intermediate may report an incomplete chain. Leave the files under Certbot’s control so subsequent renewals update what Apache reads.

5. Prove that the certificate and key match

Perform these checks before changing live traffic. For an RSA key, Apache documents comparing the modulus digests:

openssl x509 -noout -modulus -in new.crt | openssl md5
openssl rsa  -noout -modulus -in new.key | openssl md5

The two resulting digests must be identical. The MD5 output here is a convenient equality check for the public modulus, not a claim that MD5 is suitable for signing or protecting data. If the values differ, stop: installing that pair will cause Apache to fail or serve the wrong key. Locate the key generated for the CSR and repeat the issuance process if necessary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the certificate’s identity and lifetime:

openssl x509 -in new.crt -noout -subject -issuer -dates -ext subjectAltName

Check that the subject, issuer, notBefore, notAfter, and every SAN are what you expect. A certificate that matches the key but omits a required hostname is still unusable for that hostname.

Validate the chain with Ubuntu’s trust bundle and the intermediate file:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
openssl verify 
  -CAfile /etc/ssl/certs/ca-certificates.crt 
  -untrusted issuer-chain.pem new.crt

The trust-store path can vary by Ubuntu release, and a Certbot full chain should be tested using the files in its managed directory. A successful result means the leaf can be built to a trusted root with the supplied intermediates; it does not replace an end-to-end test from a client.

6. Enable SSL and reload the correct site

If SSL support is not enabled, enable the module. Enable the HTTPS site only if it is not already active:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo a2enmod ssl
sudo a2ensite example.com-ssl.conf

Use the actual filename shown in /etc/apache2/sites-available; enabling a different file can create a second VirtualHost that hides the problem rather than fixing it.

Always parse the complete configuration before asking systemd to reload Apache:

sudo apache2ctl configtest
sudo systemctl reload apache2

Proceed only when configtest reports Syntax OK. Reloading lets existing connections finish while new connections use the new certificate. If reload is unavailable, or an encrypted private key requires an interactive passphrase, use the documented restart path and provide the passphrase through the server’s secure console or service mechanism. Do not put the passphrase in a shell command, unit file, or publicly readable script.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. Test what Apache actually serves

Check from the server

Request the endpoint with the hostname that selects the intended SNI VirtualHost:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -Iv https://example.com/
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

Review the returned subject, SANs, issuer, validity dates, and certificate chain. The -servername option is essential when the server hosts multiple HTTPS names; without it, you may test the default VirtualHost instead of the one you edited.

Check from an independent client

Test from a workstation or monitoring system outside the server’s network as well. This catches load balancers, reverse proxies, CDN edges, or DNS records that still point to another machine. Confirm that every required hostname resolves to the intended endpoint and that clients receive the new certificate, not merely that Apache accepted the file.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Exercise Certbot renewal

For a Certbot-managed deployment, run:

sudo certbot renew --dry-run

This performs a renewal test without replacing the live certificate. Treat a failed dry run as an operational issue to resolve before the current certificate expires; inspect challenge access, DNS permissions, renewal configuration, and Apache reload hooks.

Why Apache fails after a replacement

“Private key does not match certificate”

The modulus digests differ, or the VirtualHost points to an old key while the certificate path was changed. Recheck both directives and repeat the equality test against the exact files Apache reads.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Permission denied” or an unreadable key

The Apache service account must be able to read the private key through its directory path, while unrelated users must not. Keep the key root-owned with restrictive mode, verify directory permissions, and check whether a security policy is blocking access. Do not solve the problem by making the key world-readable.

The old certificate is still displayed

You may have edited an inactive site, omitted the SNI name in your test, or left a proxy and load balancer serving the old certificate. Run apache2ctl -S, compare the requested hostname with ServerName/ServerAlias, and test the public endpoint from outside the host.

Hostname or SAN warning in clients

The replacement certificate does not list the requested DNS name, or the client is using an alias not included in the CSR. Obtain a corrected certificate with all required SANs and install it only after repeating the identity checks.

Incomplete chain errors

Apache may be sending only the leaf certificate, or the intermediates are in the wrong order. Use the CA-provided chain or Certbot’s fullchain.pem, then run openssl verify and inspect all certificates returned by openssl s_client -showcerts.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Malformed PEM or passphrase prompt

Check that certificate files contain intact PEM headers and footers, such as -----BEGIN CERTIFICATE-----, with no accidental text added during copying. A key encrypted with a passphrase can also prevent an unattended reload or restart. Decide explicitly whether the service design supports an encrypted key; never remove encryption merely to silence a prompt without applying the corresponding permission and backup controls.

When Apache refuses to reload, read the service status and error log immediately:

sudo systemctl status apache2
sudo journalctl -u apache2 -n 100 --no-pager
tail -n 100 /var/log/apache2/error.log

Rollback and retirement

If the new endpoint fails validation, restore the backed-up certificate, key, chain, and VirtualHost configuration, run sudo apache2ctl configtest, and reload Apache. Keep the new files isolated until you understand the failure. Once the replacement has been observed serving correctly, renewal has been tested where applicable, and your rollback window has ended, dispose of obsolete private keys according to your organization’s key-destruction policy. Do not delete the old material merely because Apache accepted the new configuration.

Operational checklist

  • The active port-443 VirtualHost and all required hostnames are documented.
  • The new private key was generated locally and was never sent to the CA.
  • The CSR and issued certificate contain every required SAN.
  • The certificate, key, and chain are installed at the exact paths referenced by Apache.
  • Private-key ownership and permissions restrict access, and encrypted backups are stored offline when an unencrypted runtime key is necessary.
  • Certificate and key equality was verified before activation.
  • apache2ctl configtest passed before reload or restart.
  • An SNI-aware endpoint test confirms the new certificate, issuer, expiry, and chain.
  • sudo certbot renew --dry-run passes for Certbot-managed certificates.
  • The previous certificate, key, and configuration remain available until production verification and rollback needs are complete.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.