mod_ssl allows you to manage SSL/TLS encryption and certificates, thereby protecting your website from malicious attacks and improving its credibility. Here’s how to install mod_ssl in CentOS.
How to Install mod_SSL in CentOS
Here are the steps to install mod_SSL in CentOS. You can follow the same steps for RHEL/Fedora Linux also.
1. Install mod_SSL
Open a terminal window or SSH into your Linux machine, and run the following command
# sudo yum install mod_ssl
You may be asked to confirm download. Type “y” and press enter.
2. Configure mod_ssl
Open mod_ssl’s config file at /etc/httpd/conf.d/ssl.conf with a text editor
# sudo vim /etc/httpd/conf.d/ssl.conf
Enable name-based virtual hosting on port 443 (HTTPS) by adding the following lines before “SSL Virtual Host Context” comment
# Use name-base virtual hosting NameVirtualHost *:443
3. Disable default HTTPS host
Disable the default https host by commenting all the lines after “SSL Virtual Host Context” comment, by adding “#” sign at the beginning of each line.
4. Restart Apache Web Server
Restart Apache web server to apply changes
# sudo service httpd restart
5. Enable SSL traffic in your firewall
Next, update your firewall to allow HTTPS requests. Most likely, it will be disabled by default. You can modify it by updating iptables rules. Paste the following command in your terminal to allow SSL traffic.
# sudo iptables -A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
6. Restart iptables
Restart iptables firewall to apply the changes
# sudo service iptables restart
That’s it! You have installed mod_ssl in CentOS