# How Exactly should I add cloudflare CDN to discourse?

**URL:** <https://meta.discourse.org/t/how-exactly-should-i-add-cloudflare-cdn-to-discourse/55706>\
**Category:** Self-hosting\
**Tags:** cdn\
**Created:** [13 januari 2017 om 15:32 UTC](https://meta.discourse.org/t/how-exactly-should-i-add-cloudflare-cdn-to-discourse/55706 "2017-01-13T15:32:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Nam\_Nguyen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nam_nguyen/32/68634_2.png) [@Nam\_Nguyen](https://meta.discourse.org/u/Nam_Nguyen)\
**Post date:** [13 januari 2017 om 16:24 UTC](https://meta.discourse.org/t/how-exactly-should-i-add-cloudflare-cdn-to-discourse/55706/4 "2017-01-13T16:24:39Z")

</div>

Hi,  
I do these steps:

## Step 1: add Droplet to Cloudflare

Here is tutorials (just in case you don’t know how to add Droplet to Cloudflare and Domain) [https://www.youtube.com/watch?v=iWaFAIRWsA4](https://www.youtube.com/watch?v=iWaFAIRWsA4)

## Step 2: Make Swap Files

> **[How To Add Swap Space on Ubuntu 16.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)**
>
> One of the easiest way of increasing the responsiveness of your server and guarding against out of memory errors in your applications is to add some swap spa…

Then Configure Local time

```
dpkg-reconfigure tzdata

```

## Step 3: Install Discourse

```
sudo -s
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse

```

**_I customize Default Email and Edit `app.yml` (You can Skip this and install Discourse as normal)_**

Copy the samples/standalone.yml file into the containers folder as app.yml:

```
sudo cp samples/standalone.yml containers/app.yml

sudo nano containers/app.yml

```

Change these line

```
DISCOURSE_HOSTNAME: 'domain.com'
DISCOURSE_DEVELOPER_EMAILS: 'me@example.com'
DISCOURSE_SMTP_ADDRESS: smtp.mandrillapp.com # (mandatory)
DISCOURSE_SMTP_PORT: 587 # (optional)
DISCOURSE_SMTP_USER_NAME: login@example.com # (optional)
DISCOURSE_SMTP_PASSWORD: pas$word # (optional)

```

Uncoment and Edit custom default Email on this line

`- exec: rails r "SiteSetting.notification_email='example@domain.com'"`

–\>\>\>\> Save the `app.yml` file, and exit the text editor.

**Bootstrap Discourse:**

```
sudo ./launcher bootstrap app

```

After the bootstrap process completes, start Discourse:

```
sudo ./launcher start app

```

After Start Discourse,

Access to your website: `domain.com`

**Install Discouse Wizard**

 ![](https://global.discourse-cdn.com/meta/original/3X/7/a/7a24804546ce5211726b4ed001674164259be29e.png)

## Step 4: start to install **Let’s Encrypt**

```
cd /var/discourse
sudo nano containers/app.yml

```

Uncomment and change these line

 ![](https://global.discourse-cdn.com/meta/original/3X/d/0/d0d4f029fc5b4c8c4a0180ff4ce5cec12cbe915c.png)

**Add Email Let’s Encrypt**

![](https://global.discourse-cdn.com/meta/original/3X/0/6/06a3fe0031cdbc6f791f9a3c62fac8dad8b75c82.png)

Then Rebuild Discourse App

```
/var/discourse/launcher rebuild app

```

After Rebuild App,

access to CloudFlare to enable SSL Full strict

[![](https://global.discourse-cdn.com/meta/optimized/3X/8/5/85794d6486bd774451560860da22129facc83b57_1_690x358.PNG) ](https://global.discourse-cdn.com/meta/optimized/3X/8/5/85794d6486bd774451560860da22129facc83b57_1_690x358.PNG)

Yes!, It’s Done!

---

_[View the full topic](https://meta.discourse.org/t/how-exactly-should-i-add-cloudflare-cdn-to-discourse/55706)._
