mod_ssl module provides SSL/TLS support for Apache web server. It manages SSL encryption and manages SSL certificates, making your website secure and more credible. mod_ssl supports SL v2/v3 and TLS v1. Let us look at how to install Apache mod_ssl module.
How to Install Apache mod_ssl module
Here are the steps to install Apache mod_ssl module on CentOS server. You can easily customize them for your Linux server. Before we proceed, please ensure you have installed Apache on your Linux system
1. Install mod_ssl
Open a terminal window and run the following command
# sudo yum install mod_ssl
If you are asked for download confirmation, type “y” and press enter.
2. Configure mod_ssl
Open mod_ssl 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 by adding the following text before “SSL Virtual Host Context” comment
# Use name-base virtual hosting NameVirtualHost *:443
3. Disable default https host
Disable default https host by commenting all the lines after “SSL Virtual Host Context” comment. You can do that by adding ‘#’ 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 you need to update your firewall to allow SSL traffic. In most cases, this will be disabled by default. You can enable this by modifying iptables rule. The following command will modify the iptables rules and enable SSL traffic on your server
# 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 Apache in CentOS