Protect User Privacy: How to Setup Cloudflare SSL

In order to enable SSL in my website, I’m using free certificate provided by Cloudflare. Here’s a quick guide about how to set up free Cloudflare SSL on your Apache server.

Apply for SSL Certificate

First, you need to sign up a free account on Cloudflare. Then, follow their steps for changing the DNS of your domain and link your website to Cloudflare.

Once you’ve changed your nameservers and are operating your site with Cloudflare as your DNS provider, click the Crypto button on the top of your dashboard. Then find Origin Certificates and create a certificate.

Choose “Let Cloudflare generate a private key and a CSR” and set the private key type to RSA. Add your domain to the list of the hostnames. Then set “Certificate Validity” to 15 years.

Once you have clicked the “Next” button, you will see “Origin Certificate” and “Private Key”. Save them into two text files: <Your Domain>.crt and private.key and upload them to your server.

Install SSL Certificate In Apache Server

Apache’s main configuration file is typically named httpd.conf or apache2.conf.

Possible locations for this file might be /etc/httpd/ or /etc/apache2/.

Open the configuration file:
vim /etc/httpd/conf/httpd.conf

Delete ‘#’ of this line:
#Include conf/extra/httpd-ssl.conf

Configure the <VirtualHost> block for SSL. Here is a sample virtual host block:
<VirtualHost *:443>
DocumentRoot   /var/www/html
ServerName     <YourDomain>
SSLEngine      on
SSLCertificateFile        /<Path>/<Your Domain>.crt
SSLCertificateKeyFile     /<Path>/private.key


Test Apache Configuration and restart Apache Server:
apachectl configtest
/etc/init.d/httpd restart

Finally, open https://<Your Domain> in your web browser and check if SSL works well.

Published by

Siujoeng Lau

Liberty will never perish.

Leave a Reply

Your email address will not be published. Required fields are marked *