To configure Apache with the mod_ssl module on CentOS or Red Hat systems, you will need to install the mod_ssl
package and enable the module in the Apache configuration.
First, install the mod_ssl
package using the following command:
sudo yum install mod_ssl
Next, open the Apache configuration file, /etc/httpd/conf/httpd.conf
, in a text editor and uncomment the following line:
LoadModule ssl_module modules/mod_ssl.so
This will enable the mod_ssl
module in Apache.
Next, you will need to configure the virtual host for your website to use SSL. To do this, you will need to create a new virtual host configuration file or edit the existing configuration file for your website. In the virtual host configuration file, add the following lines to enable SSL:
<VirtualHost *:443> SSLEngine on SSLCertificateFile /path/to/ssl/certificate.crt SSLCertificateKeyFile /path/to/ssl/private.key </VirtualHost>
Replace /path/to/ssl/certificate.crt
and /path/to/ssl/private.key
with the paths to your SSL certificate and private key, respectively.
You will also need to make sure that the Apache user (usually apache
or httpd
) has read permissions on the SSL certificate and private key files.
Finally, restart Apache to apply the changes:
sudo systemctl restart httpd
This will configure Apache to use SSL with the mod_ssl
module. You can verify that SSL is working by visiting your website using the https
protocol in a web browser.