1. Install the ssl module
# Yum-y install mod_ssl
2. Tell apache which website is to Use https, that is, to build a website. It can also be the same as what was previously set up in http.
# Vi/etc/httpd/conf. d/ssl. conf
DocumentRoot/var/www/test/html
Servername www.bkjia.com
3. Create a certificate file
# Cd/etc/pki/tls/certs
[Root@www.bkjia.com] # make server. key ### generate a key file
[Root@www.bkjia.com] # openssl rsa-in server. key-out server. key # Remove the previous password and re-export a password-free
[Root@www.bkjia.com] # make server. crt # generate a self-signed certificate
4. Replace the generated server. key server. crt with the default two.
# Vi/etc/httpd/conf. d/ssl. conf
# SSLCertificateFile/etc/pki/tls/certs/localhost. crt
SSLCertificateFile/etc/pki/tls/certs/server. crt
# SSLCertificateKeyFile/etc/pki/tls/private/localhost. key
SSLCertificateKeyFile/etc/pki/tls/certs/server. key
# Search/crt Replace the last few characters of the line local. crt with server. crt
# Replace the original private key with/etc/pki/tls/certs/server. key in the following private key section. Note that it is under the certs directory.