Instiq
Chapter 3 · HTTP servers and proxy servers·v1.0.0·Updated 7/7/2026·~13 min

What's changed: Initial version (topic 2.09, subtopics 2.09.1–2.09.4)

3.2OpenSSL and HTTPS Configuration

Key points

Learn to enable HTTPS on Apache with OpenSSL: where certificates and keys live (/etc/ssl/, /etc/pki/), enabling SSL/TLS with SSLEngine, specifying the certificate and key via SSLCertificateFile and SSLCertificateKeyFile, controlling protocol and cipher choice with SSLProtocol and SSLCipherSuite, specifying CA certificates with SSLCACertificateFile and SSLCACertificatePath, and manipulating keys/certificates with the openssl command.

Plaintext HTTP can be eavesdropped on or tampered with, so nearly every production web server runs HTTPS. Configuring TLS in Apache, and the OpenSSL operations that manage the underlying keys and certificates, are core practical skills tested at L2.

3.2.1Certificate/key storage and openssl operations

  • Certificates, private keys, and CA certificates are conventionally kept under /etc/ssl/ (common on Debian-family systems) or /etc/pki/ (common on RHEL-family systems).
  • The openssl command handles the full certificate/key lifecycle: generating private keys, creating certificate signing requests (CSRs), issuing self-signed certificates, and inspecting certificate contents.

3.2.2Apache TLS directives

  • SSLEngine on turns on SSL/TLS for that VirtualHost. SSLCertificateFile points to the server certificate and SSLCertificateKeyFile to its matching private key (certificate and key must always be a matched pair).
  • SSLProtocol controls which protocol versions are allowed (e.g., disabling old SSLv3 and permitting only TLS), while SSLCipherSuite controls the allowed cipher combinations—both used to exclude weak configurations.
  • When validating a CA—for client certificate authentication, for example—specify SSLCACertificateFile (a single bundled file of CA certificates) or SSLCACertificatePath (a directory of CA certificate files).
Exam point

Common pairings: SSLCertificateFile = certificate, SSLCertificateKeyFile = private key; SSLProtocol = allowed protocols, SSLCipherSuite = allowed cipher suites; SSLCACertificateFile = single file, SSLCACertificatePath = directory. Forgetting to set SSLEngine to on leaves HTTPS disabled even if certificates are specified.

A typical rollout clarifies the pieces. First, generate a private key with openssl, then either create a CSR from that key to send to a certificate authority, or issue a self-signed certificate on the spot for internal testing. Place the resulting certificate and key under /etc/ssl/ or /etc/pki/, tightening permissions so only root (or Apache's run user) can read the private key. In the Apache VirtualHost, first enable TLS with SSLEngine on, then point to the certificate and key separately: SSLCertificateFile /etc/ssl/certs/example.crt and SSLCertificateKeyFile /etc/ssl/private/example.key. Mismatching the certificate and key pair causes a startup error, so verifying they match is the first thing to check. Further, explicitly disable old protocols with something like SSLProtocol -all +TLSv1.2 +TLSv1.3, and use SSLCipherSuite to permit only a vetted set of strong ciphers—avoiding a permissive "allow everything" configuration. When mutual TLS via client certificates is required, add trusted CA information with SSLCACertificateFile or SSLCACertificatePath. These directives are Apache-specific, but generating, inspecting, and converting the keys and certificates themselves is consistently the job of the openssl command.

DirectiveWhat it specifiesNote
SSLEngineEnable SSL/TLSWithout on, other settings have no effect
SSLCertificateFileServer certificateMust pair with SSLCertificateKeyFile
SSLCertificateKeyFilePrivate keyRestrict permissions
SSLCACertificateFile / SSLCACertificatePathTrusted CA certificatesSingle file / directory
Warning

Trap: options that reverse the roles—"put the certificate in SSLCertificateKeyFile and the private key in SSLCertificateFile"—are wrong. File = certificate, KeyFile = private key. Also wrong: "SSLCipherSuite specifies the protocol version"—protocol version is SSLProtocol; cipher suite combinations are SSLCipherSuite, two separate directives.

Diagram from key/certificate generation with openssl to Apache configuration via SSLEngine/SSLCertificateFile/SSLCertificateKeyFile.
File = certificate, KeyFile = private key

3.2.3Section summary

  • Enable with SSLEngine on; SSLCertificateFile = certificate / SSLCertificateKeyFile = private key; stored under /etc/ssl/, /etc/pki/
  • SSLProtocol = allowed protocols / SSLCipherSuite = allowed ciphers; CA validation via SSLCACertificateFile (file) / SSLCACertificatePath (directory); key/cert operations via openssl

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. You want to enable HTTPS in an Apache VirtualHost and specify the certificate and private key separately. Which pairing is correct?

Q2. You want to disable weak old protocols (e.g., SSLv3) and allow only TLS 1.2 and later. Which directive should you use?

Q3. For client certificate authentication, you want to specify a single bundled file of trusted CA certificates. Which directive is correct?

Check your understandingPractice questions for Chapter 3: HTTP servers and proxy servers