How to install SSL certificate in a VPS Print

  • 19

In order to install a SSL certificate, make sure your plan includes a dedicated IP address. If it does not, contact us so we can assist you with adding one to your account.

First, make sure mod_ssl is installed. In Centos you can run the following command to install mod_ssl:

On Centos: yum install mod_ssl

On Ubuntu: a2enmod ssl

Restart Apache.

To install the SSL certificate follow these steps:

  1. Create a file /etc/httpd/conf.d/cert.key and place the content of the certificate key in it. It will look like (with more lines):

    -----BEGIN RSA PRIVATE KEY-----
    MIICXgIBAAKBgQDsvYWqOtJBR+j15pCITwyM48Cp3rBArdJOsOjoFrU2CXiDpYAb
    4ZiA3CD+wTQtod+3aeRTAkEAuXfD0NSgcTYsqHS+HHUyDZifrjZBPhBNL4ONAvof
    ReXZzngKgFTGhfUm0Ypu6QVTRHit+Miv+AyY72KCUsN4/A==
    -----END RSA PRIVATE KEY-----

  2. Create a file /etc/httpd/conf.d/cert.crt and place the content of the certificate in it. It will look like (with more lines):

    -----BEGIN CERTIFICATE-----
    MIIDODCCAqGgAwIBAgIDC+KlMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
    MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
    UeHR9A2VwXvIbcrxYoLLFZraqI56CNwRCNIsUB9Z9k+6Y0J+A2iRo75Ws2cHPAMc
    97keASGvyDZy1w9W
    -----END CERTIFICATE-----

  3. Edit /etc/httpd/conf.d/ssl.conf (centos) or /etc/apache2/sites-enabled/default-ssl (ubuntu) and change SSLCertificateKeyFile and SSLCertificateFile directives so they point to the files listed in 1 and 2.

    SSLCertificateFile /etc/httpd/conf.d/cert.crt
    SSLCertificateKeyFile /etc/httpd/conf.d/cert.key

  4. Restart apache by running service httpd restart

Was this answer helpful?

« Back