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

Fix an SSL connection error on Ubuntu by identifying which layer is failing: network reachability, Apache’s HTTPS listener, the TLS virtual host, certificate files and chain, or protocol negotiation. Check each layer in that order instead of replacing certificates at random.

Enable mod_ssl, enable the correct SSL virtual host, verify that Listen and <VirtualHost> use the address and port clients reach, inspect the certificate and private key, test the live endpoint with OpenSSL using SNI, then run Apache’s configuration test before restarting. The same workflow distinguishes “connection refused” from a browser trust warning and from a TLS handshake failure.

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.

Start with the failure you actually have

The browser’s wording is a clue, not a diagnosis. “Connection refused” usually means no process accepted the TCP connection, while a timeout often points to DNS, routing or a firewall. A certificate warning means TLS was reached but the certificate or chain could not be trusted. A handshake or protocol error means the client and server connected but could not agree on TLS parameters.

Observed symptom Most likely layer First checks
Connection refused Listener, service, firewall or address mismatch DNS, port 443, Apache status, Listen and <VirtualHost>
Connection times out Network path or filtering DNS result, host firewall, cloud security rules and reachability
HTTP response on an HTTPS URL, or a hang Protocol mismatch Use https://; confirm port 443 is an SSL listener
Certificate name, date or trust warning Certificate identity or trust chain SAN, validity, issuer and intermediate certificates
TLS handshake or protocol error Version, cipher, SNI or certificate negotiation openssl s_client with the real hostname and selected TLS versions
Apache fails to restart Configuration syntax, file path, key or permissions sudo apache2ctl configtest, journal and SSL error log

Work from the server outward. A perfectly issued certificate cannot help if Apache is stopped or port 443 is blocked, and changing TLS versions will not fix a certificate whose SAN does not contain the hostname.

#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.

1. Confirm DNS, port and Apache reachability

Check that the hostname reaches this Ubuntu server

Resolve the exact name users enter, including any www or other subdomain. It must point to the server’s public address (or to the load balancer that forwards to it). If DNS points elsewhere, you may be testing a different Apache installation and seeing an unrelated certificate.

Check both IPv4 and IPv6 when the name has both records. A broken IPv6 route can make some clients time out even though IPv4 works. Temporarily test the known server address only for diagnosis; keep the hostname in the final TLS test because Apache uses SNI to select a virtual host.

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

Check firewall and service state

Allow inbound TCP 443 in every layer that filters traffic: the Ubuntu host firewall, a cloud security group, a hardware firewall and any reverse proxy. Also confirm that Apache is running:

sudo systemctl status apache2.service

A stopped service, a failed boot or a process listening only on another address produces a refusal. The status output and recent journal entries normally show why startup failed. Do not repeatedly restart while configuration is unknown; test first, correct the reported error, and then restart once.

Check which addresses and ports Apache listens on

Apache’s Listen directives and SSL virtual host must describe the endpoint clients reach. For a conventional HTTPS service, the configuration should include a listener for port 443 and an SSL virtual host such as <VirtualHost *:443> (or the specific local address). A mismatch—such as listening on one address while the virtual host names another—can cause connection refusal or route the request to the wrong site.

Inspect the effective configuration and socket table with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apache2ctl -S
sudo ss -ltnp | grep ':443'

The first command lists virtual hosts and their files; the second shows whether a process is actually listening. If nothing owns port 443, resolve the service or enablement problem before troubleshooting certificates.

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

2. Enable Apache TLS and the correct virtual host

Load mod_ssl

Ubuntu provides TLS support through Apache’s mod_ssl module. Enable it with:

sudo a2enmod ssl

The command is normally idempotent. If it reports that the module is already enabled, continue to the site configuration. A module being enabled does not by itself make a site serve HTTPS; an SSL virtual host must also be enabled.

Enable an HTTPS site

For the stock Ubuntu configuration, enable the default HTTPS site:

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

The corresponding file is /etc/apache2/sites-available/default-ssl.conf. A production server should normally use its own narrowly scoped file in /etc/apache2/sites-available/, with the intended ServerName, optional ServerAlias values and certificate paths. Enable that file with sudo a2ensite your-site-ssl.conf rather than leaving several unrelated SSL virtual hosts to compete for the same name.

After enabling a site, inspect the map with sudo apache2ctl -S. The output should show the hostname and port 443 associated with the file you edited. If the wrong virtual host is selected, fix duplicate or missing ServerName and ServerAlias entries and retest with SNI.

3. Verify the SSL virtual-host settings

Use the right hostname and port

An SSL virtual host should identify the DNS name users request and listen on the port reached by HTTPS. A minimal shape is:

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName example.com
        ServerAlias www.example.com
        SSLEngine on
        SSLCertificateFile /path/to/server.crt
        SSLCertificateKeyFile /path/to/server.key
        DocumentRoot /var/www/example
    </VirtualHost>
</IfModule>

Use paths that exist on this server, and do not copy the example hostname or paths literally. If HTTP and HTTPS are separate virtual hosts, ensure the HTTPS request is not accidentally handled by a plain-HTTP definition.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Check certificate directives and file readability

SSLCertificateFile must point to the intended server certificate, and SSLCertificateKeyFile must point to its matching private key. Ubuntu commonly stores public certificates under /etc/ssl/certs and private keys under /etc/ssl/private, although an administrator may use another protected directory.

Confirm the files exist and that Apache can read them while other users cannot:

sudo ls -l /path/to/server.crt /path/to/server.key
sudo apache2ctl configtest

A key that is too restrictive for the Apache daemon causes startup failure; a key that is world-readable is a security exposure. Preserve ownership and permissions appropriate to your Ubuntu installation, and avoid placing private keys in a web document root.

Check that the certificate and key belong together

A certificate for one key paired with another may pass a superficial file check but fail during startup or handshake. Compare the public-key identity from both files. For RSA certificates, the traditional modulus comparison is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
openssl x509 -noout -modulus -in /path/to/server.crt | openssl sha256
openssl rsa  -noout -modulus -in /path/to/server.key | openssl sha256

The resulting digests must match. If the key is not RSA, use the key type’s appropriate public-key extraction method or inspect both public keys with OpenSSL; do not convert or overwrite a key simply to make a command fit.

4. Inspect hostname, dates and chain

Verify the SAN, not just the old common name

Modern clients match the requested hostname against the certificate’s Subject Alternative Name (SAN) entries. Inspect the certificate:

openssl x509 -in /path/to/server.crt -noout -text

Look for the SAN list and compare it character-for-character with the hostname users enter. A certificate for example.com does not automatically cover www.example.com; a wildcard has its own scope and does not cover an arbitrary deeper level. Correct the virtual host name or install a certificate whose SANs cover every published hostname.

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.

Check validity dates and issuer

In the same output, check “Not Before” and “Not After,” and verify that the server clock is accurate. A certificate that is not yet valid, expired, or issued by an authority the client does not trust produces a browser warning even when Apache is configured correctly. The issuer should be the expected certificate authority for a production site.

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.

Serve the intermediate certificates

Browsers commonly need the server to send one or more intermediate CA certificates so they can build a path from the server certificate to a trusted root. An otherwise valid leaf certificate can therefore fail on clients if Apache sends only the leaf. Install the CA-provided full chain in the format expected by your Apache version and certificate provider, then point the certificate directive at the resulting chain file when required. Keep the private key separate.

For a local chain check, verify the certificate against a CA bundle:

openssl verify -CAfile ca.crt /path/to/server.crt

This command is only as useful as the CA file supplied. A private test CA needs its own trusted root; a public certificate needs a current trust bundle. A successful local verification does not prove that Apache is sending the intermediate chain, so test the live endpoint as well.

Use self-signed certificates only for controlled tests

A self-signed certificate can validate wiring on a lab network or during development, but browsers and operating systems will not generally trust it by default. Ubuntu documentation cautions that self-signed certificates should not be used in most production environments. For a public service, use a CA-signed certificate and serve its required intermediates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

5. Test the live TLS handshake with OpenSSL

Test the same hostname a user enters

Run the OpenSSL client from a machine that can reach the server:

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

The -servername value is essential when the address hosts multiple SSL virtual hosts. It sends SNI, allowing Apache to select the certificate for example.com. Read the negotiated protocol, the presented certificate subject and SANs, the issuer, and the verification result. If the certificate is for a different site, investigate SNI and virtual-host ordering rather than replacing the certificate blindly.

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.

Separate protocol negotiation from trust errors

A handshake can fail before certificate verification if the client and server have no common TLS version or cipher policy. Test supported versions explicitly when diagnosing an old client or a hardened server:

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

If one version succeeds and another fails, compare Apache’s TLS policy with the client’s capabilities and the operating system’s OpenSSL version. Do not weaken production protocol settings merely to make an obsolete client work; upgrade the client or define a deliberate compatibility policy.

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

Recognize a plain HTTP/HTTPS mix-up

Sending an ordinary HTTP request to an SSL port, or initiating TLS against a port that serves plain HTTP, produces protocol errors, garbled responses or a hang. Use http:// for the clear-text listener and https:// for the TLS listener, and verify that the reverse proxy (if present) forwards to the correct backend protocol.

6. Make changes safely and recover from a failed restart

Validate before restarting

After every certificate or virtual-host edit, run:

sudo apache2ctl configtest

Proceed only when it reports a successful syntax check. This catches misspelled directives, missing files and malformed configuration without replacing the currently running process.

Restart and inspect the result

sudo systemctl restart apache2.service
sudo systemctl status apache2.service

If the restart fails, immediately inspect the service journal and Apache’s error logs. Typical causes include a certificate path typo, an unreadable key, a key/certificate mismatch, a duplicate binding, an unsupported directive or an incomplete chain file. Correct the specific reported line, rerun configtest, and restart again.

Use logs to distinguish startup from handshake failures

A startup error appears in the systemd result and Apache error log before any client can connect. A handshake error appears while Apache remains running and usually includes a client address or TLS alert. Check timestamps that correspond to a fresh test, and increase logging only temporarily if normal entries do not identify the failure; verbose TLS logs can contain sensitive connection details and become noisy quickly.

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

7. A practical decision tree

  1. No TCP connection: Resolve the hostname, check IPv4/IPv6, permit TCP 443 through firewalls, confirm Apache is active and verify a process listens on the expected address and port.
  2. TCP connects but the response is nonsensical: Confirm the client uses HTTPS on the TLS port and that no proxy is sending plain HTTP there.
  3. Apache serves the wrong certificate: Run apache2ctl -S, correct ServerName/ServerAlias, and repeat openssl s_client with -servername.
  4. Certificate warning: Check SAN, validity dates, issuer trust and the complete intermediate chain. Replace a production self-signed certificate with a CA-signed one.
  5. Handshake fails only for some clients: Test TLS 1.2 and TLS 1.3 separately, compare client capabilities and server policy, and avoid unnecessary protocol downgrades.
  6. Apache will not start: Run apache2ctl configtest, read the journal and SSL error log, verify file paths, key matching and daemon permissions, then restart only after the test passes.

8. Prevent the next SSL outage

  • Keep each site’s HTTP and HTTPS virtual hosts explicit, with one authoritative ServerName and only the required aliases.
  • Monitor certificate expiration and renew before the “Not After” date; reload Apache after renewal and test the live hostname with SNI.
  • Store private keys outside web roots, limit permissions, and retain a protected backup for recovery.
  • Document which certificate file contains the leaf certificate and which contains the intermediate chain.
  • After DNS, firewall, proxy or Apache changes, test from an external network as well as from the server itself.
  • Keep a known-good configuration copy so a failed certificate deployment can be reverted after a configuration test.

Frequently asked questions

Why is Apache’s HTTPS connection refused?

Usually Apache is stopped, port 443 is blocked, no process is listening there, or the Listen and <VirtualHost> address/port settings do not align. Check those items before changing certificates.

Why does the certificate look valid on the server but fail in a browser?

The live server may be sending a different virtual host’s certificate, omitting an intermediate CA, using a hostname absent from the SAN list, or presenting a self-signed issuer. Test the endpoint with SNI rather than inspecting only a local file.

Can I use the default SSL site in production?

You can use it to prove that Apache TLS is wired correctly, but a production deployment should use its own scoped virtual host and the certificate, aliases and document root for the actual site.

What does a successful apache2ctl configtest prove?

It proves that Apache can parse the configuration at that moment. It does not prove that DNS, firewalls, the selected SNI virtual host, certificate trust or every client’s TLS policy is correct; those require live and external tests.

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

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.