Skip to content

How to Create an SSL Certificate on Apache for CentOS 6

Cloud Infrastructure Expert
How to Create an SSL Certificate on Apache for CentOS 6

 

Setting up SSL/TLS certificates is essential for securing communications between your server and clients. This guide will show you how to create and install an SSL certificate on Apache for CentOS 6.

1. Install Apache and OpenSSL

Ensure that Apache and OpenSSL are installed:

sudo yum install httpd mod_ssl openssl

2. Create a Directory for SSL Certificates

Create a directory to store your SSL certificates and keys:

sudo mkdir /etc/httpd/ssl

3. Generate a Self-Signed SSL Certificate

Generate a private key and a self-signed SSL certificate with the following command:

sudo openssl req -new -x509 -days 365 -nodes -out /etc/httpd/ssl/apache.crt -keyout /etc/httpd/ssl/apache.key

You will be prompted to enter some information. Fill in the details as appropriate for your organization. For local development, you can use placeholder values.

4. Configure Apache to Use SSL

Edit the SSL configuration file for Apache:

sudo nano /etc/httpd/conf.d/ssl.conf

Update the file with the following configuration:



    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    SSLEngine on
    SSLCertificateFile /etc/httpd/ssl/apache.crt
    SSLCertificateKeyFile /etc/httpd/ssl/apache.key

    ErrorLog logs/ssl_error_log
    CustomLog logs/ssl_access_log combined

    

Save and close the file (press Ctrl+X, then Y, and Enter).

5. Restart Apache

Apply the changes by restarting Apache:

sudo service httpd restart

6. Verify SSL Installation

Open a web browser and navigate to https://your_server_ip. You should see your site with HTTPS, and the browser will likely display a warning because the certificate is self-signed.

7. Obtain a Trusted SSL Certificate (Optional)

For a production environment, it is recommended to obtain an SSL certificate from a trusted Certificate Authority (CA). You can use services like Let’s Encrypt for a free, trusted certificate.

8. Keep Your SSL Certificates Updated

Ensure you renew your SSL certificates before they expire to maintain secure communications. Regularly check for updates and renewals if using a CA-signed certificate.

Windows VPS Deutschland

Windows VPS España

Windows VPS Nederland

Windows VPS Italia

Windows VPS Portugal

VPS Windows Italia

Windows VPS

Windows VPS

Windows VPS Sverige

Windows VPS Norge

Windows VPS

Windows VPS Türkiye

Windows RDS (Remote Desktop Services)

Windows VPS

Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.