I just bought some SSL certs from a CA and I'm having problems getting them to work with the default SSL site deployed with apache2 (Debian 10).
Strangely, I never made a certificate request. I just had to prove I was the owner of the site, then the certificate was downloaded in a *.zip with these files (and the first line of each file):
ca_bundle.crt -----BEGIN CERTIFICATE-----
certificate.crt -----BEGIN CERTIFICATE-----
private.key -----BEGIN RSA PRIVATE KEY-----
I deployed those to /etc/ssl/.../
or /etc/apache2/ssl.crt/
and referred to them in the config file. My /etc/apache2/sites-enabled/default-ssl.conf
looks like this (I removed most comments):
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/certificate.crt
SSLCertificateKeyFile /etc/ssl/private/private.key
#SSLCertificateChainFile /etc/apache2/ssl.crt/ca_bundle.crt
SSLCACertificatePath /etc/ssl/certs/
SSLCACertificateFile /etc/apache2/ssl.crt/ca_bundle.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
After running systemctl restart apache2
, loading the https://
version of the site gives me the familiar "Warning: potential security risk ahead" as if it were a self-signed cert.
I think I don't understand which options do what.
Since this is such a basic question, I thought I'd find some good explanations on stack-exchange, but it appears I'm not alone in understanding this. It also appears that there isn't really a good answer out there yet.
- https://unix.stackexchange.com/questions/36786/how-to-configure-ssl-in-apache
- https://webmasters.stackexchange.com/questions/58650/what-steps-are-required-to-enable-ssl-on-apache2-with-ubuntu
- https://stackoverflow.com/questions/37939806/ssl-on-apache-http-server
- Apache2 Vhost HTTP to HTTPS Redirect not working in a strange way