Get certificate Take the domain name www.example.com as an example Select the environment to download the certificate for "Apache". After downloading, extract the following files: chain.crt 、 www. example .com.crt 、 www. example .com.key
chain.crt The file includes a section of certificate code
——-BEGIN CERTIFICATE -- to -- END CERTIFICATE --- www. example .com.crt The file includes a section of certificate code
——-BEGIN CERTIFICATE -- to -- END CERTIFICATE --- www. example .com.key The file contains a private key code
——-BEGIN RSA PRIVATE KEY -- to -- END RSA PRIVATE KEY --- Certificate installation Edit the Apache root directory conf/httpd.conf Files, finding #LoadModule ssl_module modules/mod_ssl.so and # Include conf/xtra/httpd-ssl.conf , remove the previous # comment. Edit the conf/extra/httpd-ssl.conf file in the Apache root directory, and modify the following contents: <VirtualHost www.example.com:443> DocumentRoot "/var/www/html" ServerName www.example.com SSLEngine on # Enable SSL function SSLCertificateFile/usr/local/apache/conf/www.example.com.crt # Certificate file SSLCertificateKeyFile/usr/local/apache/conf/www.example.com.key # Private key file SSLCertificateChainFile/usr/local/apache/conf/chain. crt # Certificate chain file
After configuration, restart Apache to use //www.example.com Came to visit |