Setup CloudFlare CDN and Flexible SSL Certificate for WordPress Websites:

1. Add your domain to Cloudflare in Free Plan:

  1. Log in to your Cloudflare account.
  2. Click on Add site from the top navigation bar.
  3. Enter your website’s root domain (For example, if your website is www.example.com, type example.com) and then click Add Site. …
  4. Cloudflare attempts to automatically identify your DNS records. This process takes approximately 60 seconds to complete.
  5. Click Next. …

CloudFlare

6. Select a plan level as Free Plan.

7. Click Confirm in the Confirm Plan window that appears.

2. Change your domain nameservers to Cloudflare:

1. Enter your domain at ICANN WHOIS field:

2. Log into the administrator account for your domain registrar.

3. Replace the current nameserver records in your registrar account with your domain’s Cloudflare nameservers. Allow up to 72 hours for nameserver changes to globally propagate.

4. Refresh the Cloudflare Overview app. If Complete your nameserver setup still appears, Perform the following steps:

  • Ensure the Name Server output correctly spells the Cloudflare nameservers and confirm Cloudflare’s nameservers are the only nameservers listed.
  • If the Name Server output is correct, click the Re-check now  button in the Cloudflare Overview app.

5. If Complete your nameserver setup no longer appears in the Cloudflare Overview app, you have successfully updated your nameservers and your domain is active at Cloudflare.

 Why SSL is Important?

When a person visits a secure website, the SSL certificate helps the browser to identify whether the server accessed is the correct one or not. Most importantly, this process happens in a fraction of a second. The main work of SSL is to secure sensitive information about the user which in turn decreases cyber-crimes. These days, with the release of Chrome 68, it is necessary to secure your site with SSL certification.

 Benefits of SSL

SSL is necessary for protecting the websites that handle important details like credit cards, passwords, etc. SSL provides privacy, data integrity and critical security for both the website as well as the user’s personal information. From 2018 onwards Google is looking for SSL certificate when it crawls a website. This is done to secure the Internet which will make life easier for online users and people can enjoy the internet service without any fear of cyber-crime. 

Step 1 – Create an Origin CA certificate

You can generate your own Origin CA certificate in the Cloudflare dashboard:

  1. Log in to Cloudflare.
  2. Select the appropriate account for the domain requiring an Origin CA certificate.
  3. Select the domain.
  4. Click the SSL/TLS app.
  5. Click the Origin Server tab.
  6. Click Create Certificate to open the Origin Certificate Installation window.Cloudflare Certificate Download
  7. In the Origin Certificate Installation window, choose either:
    • Let Cloudflare generate a private key and a CSR – requires specifying whether the Private key type is RSA or ECDSA.
    • I have my own private key and CSR – requires pasting the Certificate Signing Request into the text field.
  1. List the hostnames (including wildcards) the certificate should protect with SSL encryption. The zone root and first level wildcard hostname are included by default.
You can include up to 100 hostnames or wildcard hostnames on a single certificate and can include hostnames for other domains within the same Cloudflare account. You can also add support for multi-level subdomains such as *.test.dev.www.example.com.
  1. Choose the certificate expiration. The default is 15 years and the minimum is 7 days.
  1. Click Next.
  2. Select the Key Format. Select the key pair format that best matches your environment. Most OpenSSL-based web servers such as Apache and NGINX expect PEM files (Base64 encoded ASCII), but also work with binary DER files. Windows and Apache Tomcat users must opt for PKCS#7.
  3. Copy the signed Origin Certificate and Private key details into separate files as instructed by the Origin Certificate Installation window.
Be sure to copy the Private key information before clicking OK. For security reasons, the Private key is not displayed again after Origin certificate creation.
  1. Click OK.

Step 2 – Install an Origin CA certificate at your origin web server

Adding an Origin CA certificate to an origin web server requires several general steps:

  1. Upload the Origin CA certificate (created above in Step 1) to your origin web server.
  2. Use the linked installation guides below to update your web server configuration to point to the certificate.
  3. (Optional for most origin web servers) Upload Cloudflare’s CA root certificate to your origin web server.
Some web servers, such as IIS and cPanel, validate the Origin CA root certificate. Such web servers require Cloudflare’s root RSA certificate during configuration.
  1. Enable SSL and port 443 at your origin web server.
  2. Check that your origin server firewall doesn’t block connections to port 443.

Step 3 – Configure the SSL/TLS mode in the Cloudflare SSL/TLS app

Instruct Cloudflare to encrypt traffic to your origin web server after you install the Cloudflare Origin CA certificate at your origin web server. Set the SSL/TLS encryption mode in the Cloudflare SSL/TLS app to either Full or Full(strict)to enable encryption between Cloudflare and your origin web server.

Make this change globally via the SSL/TLS app only if all of your origin hosts are protected by Origin CA certificates or publicly trusted certificates.  Otherwise, consider setting SSL to Full or Full(strict) via the Cloudflare Page Rules app.
To avoid redirect loop errors, first ensure your origin web server configuration does not redirect HTTPS to HTTP or HTTP to HTTPS in a manner contrary to how the Cloudflare SSL/TLS encryption mode is configured for Cloudflare connections to your origin web server.

 Step 4 – Add Cloudflare Origin CA root certificates

(optional)

Some origin web servers require uploading the Cloudflare Origin CA root certificate. See below for an RSA and ECC version of the Cloudflare Origin CA root certificate. Click on a link to download a file:

cPanel does not support ECC certificates. Use the Origin CA root RSA certificate below.

Alternatively, click to expand the root certificate contents for copy and paste into your origin web server configuration:

 

Cloudflare CA certificates

unlike a free public certificate from Let’s Encrypt, we’re not required to renew the certificate every few months. In fact, we can just leave it at the default, which is 15 years! Now, yes you can configure a chron job to auto-renew your Let’s Encrypt certificate but anytime we can keep from using additional server resources, that’s a good thing.

So we just click Next and move on to the next screen.

You can choose the key format depending on the type of web server that you’re using. For Apache and/or NGINX, the default PEM format will work just fine. So what we need to do is just copy and paste ALL the code from the Origin Certificate and paste it over into Certificate field in WHM.

CloudFlour certicate 

Resolving mixed-content issues

By the time you get to this step, your site should automatically redirect the visitors to the HTTPS version of the site.

Redirecting a WordPress site can lead to mixed-content issues. This means that some resources (including links, images, scripts,etc.) are loaded over the insecure ‘HTTP’ protocol while the site is loaded over the ‘https’. Depending on the browser, the padlock might be missing from the address bar or your site will not be displayed as fully secured.

Hardcoded insecure URLs

The URLs which are hardcoded can be found in theme and/or plugin files. This happens because developers use absolute instead of relative paths (i.e. http://mywebsite.com/wp-content/image.png (absolute) vs /wp-content/image.png (relative)).

In this case, you will have to edit the problematic files manually. Since it is impractical to just search the theme/plugin files for the hardcoded links, the best thing to do is to use the String Locator plugin. It will help you locate the file and the exact line of code on which the insecure URL is located.

Verify that your site is resolving under HTTPS

If you followed these steps correctly, your site will resolve under HTTPS. In order to avoid any issues in the process, it is important to do everything in the same order. Bear in mind that some changes will take more time, therefore you might not be able to do this in one go.

If you are using a caching plugin, empty the cache. It is also a good idea to clear the cache from your browser before checking to see if it is resolving correctly.

2. Installing required WordPress plugins

  • Really Simple SSL
  • CloudFlare Flexible SSL Plugin
  • HTTPS redirection plugin
  • WordPress HTTPS (SSL)