HTTPS Enabling httpd https on Centos Server - alex-aleyan/linux_wiki GitHub Wiki
Installing and using OpenSSL:
sudo yum install mod_ssl openssl
Generate private key:
sudo openssl genrsa -out ca.key 2048
Generate CSR:
sudo openssl req -new -key ca.key -out ca.csr
Generate Self-Signed Key:
sudo openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Copy the newly generated files to the correct locations:
sudo cp ca.crt /etc/pki/tls/certs
sudo cp ca.key /etc/pki/tls/private/ca.key
sudo cp ca.csr /etc/pki/tls/private/ca.csr
/etc/httpd/conf.d/ssl.conf
:
Open SSLCertificateFile /etc/pki/tls/certs/localhost.crt
changes to:
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
changes to:
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
Restart the Apache daemon with the command:
sudo systemctl restart httpd