Apache SSL configuration generator
Generate mod_ssl settings for Apache httpd with TLS 1.2/1.3, HSTS and a redirect, plus the modules and versions they need.
Runs in your browser Everything you enter is processed locally with JavaScript and is never uploaded to ssl.sh.
The Apache preset of the TLS config generator writes mod_ssl settings for Apache httpd. Pick the profile and options, copy the output into your site configuration (for example /etc/apache2/sites-available/example.com-ssl.conf or /etc/httpd/conf.d/ssl.conf), test with apachectl configtest and reload.
Example: intermediate profile
<VirtualHost *:80>
ServerName example.com
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /etc/ssl/example.com/fullchain.pem
SSLCertificateKeyFile /etc/ssl/example.com/privkey.pem
Protocols h2 http/1.1
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>
# global settings (outside <VirtualHost>)
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
SSLOpenSSLConfCmd Curves X25519:prime256v1:secp384r1
SSLHonorCipherOrder off
SSLSessionTickets off
Version requirements
- Apache 2.4.37+ with OpenSSL 1.1.1+ for TLS 1.3 (
apachectl -Vandopenssl version). - Apache 2.4.8+ to put the chain in
SSLCertificateFile. Older versions needSSLCertificateChainFile chain.pem. - mod_http2 for the
Protocols h2 http/1.1line; drop the line if the module is not available. - X25519MLKEM768: replace the Curves line with
SSLOpenSSLConfCmd Groups X25519MLKEM768:X25519:prime256v1:secp384r1when httpd links OpenSSL 3.5+.
Test and reload
sudo apachectl configtest && sudo systemctl reload apache2 # httpd on RHEL, Rocky, AlmaLinux
Common mistakes
- Duplicate SSLProtocol lines: distribution files such as
ssl.conforoptions-ssl-apache.conf(written by certbot) may set their own values. The last one read wins; search withgrep -ri sslprotocol /etc/apache2 /etc/httpd. - Header not sent:
mod_headersis not enabled, or the header is in the port-80 VirtualHost only. - Old chain file: after renewal
SSLCertificateChainFilestill points to an outdated intermediate. Use the full chain inSSLCertificateFile.
FAQ
Which modules do I need?
mod_ssl for TLS, mod_headers for the HSTS header, mod_rewrite for the redirect and mod_http2 for HTTP/2. On Debian and Ubuntu enable them with a2enmod ssl headers rewrite http2.
Where does each directive go?
Certificate files, ServerName and the HSTS header belong in the
Apache says 'Invalid command SSLOpenSSLConfCmd'. Why?
That directive exists only when mod_ssl is built against OpenSSL 1.0.2 or newer; some builds against LibreSSL or old OpenSSL lack it. Remove the line, or upgrade.