logo
. . .

How to Install SSL in Centos Server.

Here are the general steps to install SSL on a CentOS server.

Step 1: Install OpenSSL.
Ensure that OpenSSL is installed on the CentOS server. You can install it using the following command:-
[ sudo yum install openssl ]

Step 2 : Generate a Private Key and CSR.
a). Use the "openssl" command to generate a private key and a CSR. Replace 'your_domain' with your actual domain name:-
[ openssl req -newkey rsa:2048 -nodes -keyout your_domain.key -out your_domain.csr ]
b). Follow the prompts to enter the required information, including the Common Name (CN), which should be your domain name.

Step 3 : Submit CSR to a Certificate Authority (CA) or Use a Self-Signed Certificate.
a). If you are obtaining an SSL certificate from a trusted CA, submit the CSR to them and follow their process for certificate  issuance.
b). If you are using a self-signed certificate for testing or internal use, you can generate a self-signed certificate using the following command:
[ openssl x509 -req -days 365 –in your_domain.csr -signkey your_domain.key -out your_domain.crt ]

Step 4: Configure Apache to Use SSL.
a). Update your Apache configuration to enable SSL. Edit the Apache configuration file, usually located in   "/etc/httpd/conf/httpd.conf" or "/etc/httpd/conf.d/ssl.conf".

b). Make sure to replace "your_domain.com", "/path/to/your_domain.crt", and "/path/to/your_domain.key" with your actual domain and file paths.

Step 5: Restart Apache.
After making the changes, restart Apache to apply the new configuration by the following command.
[ sudo systemctl restart httpd ]

Conclusion: Now, your Apache web server should be configured to use SSL. Access your site using “https://your_domain.com" to verify that SSL is working correctly.