Nginx TLS Protocol and Session Policy
Choose a protocol policy
A TLS handshake selects cryptographic settings before an HTTP request is processed. A connection succeeds only if client and server have compatible versions, algorithms and credentials. Use TLS 1.2 and TLS 1.3 for this teaching fixture; older protocol versions are not a compatibility shortcut. A supported operating-system package, TLS library and security policy are prerequisites.
ssl_protocols TLSv1.2 TLSv1.3;ssl_session_cache shared:lesson_tls:2m;ssl_session_timeout 5m;ssl_session_tickets off;This allows two protocol versions and sets a small shared session cache. It disables ticket-based resumption for this fixture; it is not a universal performance recommendation. Place a consistent protocol policy at http level because parts of negotiation occur before the final virtual host is chosen. Check nginx -V for build and runtime library details.
Cipher suites are version dependent
TLS 1.2 cipher suites describe more of the handshake than TLS 1.3 cipher suites, which specify symmetric protection and a hash. With OpenSSL, ssl_ciphers controls the older cipher-list interface; it does not select TLS 1.3 cipher suites. If a reviewed policy requires explicit TLS 1.3 selection, the OpenSSL Ciphersuites command can be passed via ssl_conf_command on compatible Nginx builds (directive introduced in 1.19.4). Normally prefer maintained library or distribution policy rather than copying a long cipher list.
openssl ciphers -v -s -tls1_2openssl ciphers -v -s -tls1_3These commands display suites available under the local OpenSSL settings. They do not prove which suites a running Nginx listener negotiates. Compare actual negotiated settings in an approved test environment. A client can still fail due to incompatible certificate signatures or groups.
Connection reuse versus session reuse
HTTP keepalive sends another request on an existing connection. TLS resumption establishes a new connection using previously established session information, potentially reducing handshake cost. A shared cache can serve multiple workers; session tickets can avoid storing all session state on the server. Ticket encryption keys are secrets. Nginx 1.23.2 and later can manage ticket key rotation through a shared cache when explicit keys are absent. When managing a fleet manually, distribute the current and previous keys securely, coordinate rollout, and retire old keys after the permitted overlap. Never share keys across unrelated trust domains.
Stage A: all nodes accept old and new; issue oldStage B: all nodes accept new and old; issue newStage C: after approved overlap, accept only newWith explicit ssl_session_ticket_key entries, the first key is used for new tickets. Later keys allow decryption during a transition. A key compromise requires incident response rather than routine overlap. Resumption can complicate immediate revocation expectations; plan for existing connections and cached sessions as well.
Certificate status and browser policy
OCSP is a way to ask about certificate revocation status. Server stapling supplies a signed status response during the handshake when supported by the issuing CA and server configuration. It requires the issuer chain and a usable responder; verify responses and monitor freshness. Some CAs do not provide OCSP, so do not enable stapling indiscriminately. Client certificate OCSP validation is a separate feature. CRLs are another mechanism with update and freshness requirements.
add_header Strict-Transport-Security "max-age=300" always;HSTS is a browser instruction to remember HTTPS-only access to a host. It must arrive over valid HTTPS; it is not encryption or a substitute for a certificate. Before deployment confirm redirects, certificates and all affected names. Start with a short duration; omit includeSubDomains until every affected subdomain is ready. Do not enroll in preload in this lab. Removing the header alone does not erase previously cached policies; a valid HTTPS response with max-age=0 can clear the host policy, subject to inherited or separately stored policies.
Do not treat a successful configuration parse as proof of protocol negotiation, session reuse or browser HSTS behavior.
Practice
Compare HTTP keepalive, TLS resumption and a full handshake. Plan a ticket-key rotation and describe how to validate both protocol versions on the optional loopback listener. Sources: https://nginx.org/en/docs/http/ngx_http_ssl_module.html; https://nginx.org/en/docs/http/configuring_https_servers.html; https://datatracker.ietf.org/doc/html/rfc6797.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Nginx TLS Protocol and Session Policy
Choose a TLS protocol policy, distinguish cipher configuration from session reuse, and assess certificate status and HSTS rollout.
What does ssl_ciphers control on OpenSSL builds?
What is TLS session resumption?
Which key issues new tickets in an explicit rotation list?
When is server OCSP stapling appropriate?
Why start HSTS with a short duration?