Tag Archives: cloudflare

Configure apache to log the real client IP instead of cloudflare IP in http access logs (WordPress)

If you are running a WordPress site and you have cloudflare setup, you may have noticed that the http access logs log the IP of cloudflare instead of the actual client IP. This is a guide to enable logging of the real client IP instead of the cloudflare IP in the apache2 logs. This was tested on a Ubuntu 20.04 machine + apache2 and traffic is proxied from cloudflare.

Install Prerequisites:

sudo apt-get install apache2-dev libtool git

Git clone the mod_clouflare repo from cloulflare:

cd ~/
git clone https://github.com/cloudflare/mod_cloudflare.git
cd mod_cloudflare

Use the Apache extension tool to convert the .c file into a module:

apxs -a -i -c mod_cloudflare.c

Restart Apache:

sudo apachectl restart

Verify that the module is active:

apache2ctl -M|grep cloudflare

The output should show “cloudflare_module (shared)

Now your apache logs should show the real client IP instead of the cloudflare IPs.

tail -f /var/log/apache2/access.log

-Below is screenshot of access log that shows the real client IP(right click and open image in new lab for high res image):

access.log screenshot

Sources/Credits/References:

Cloudflare
Noirth Security

How to setup Cloudflare CDN with Bigrock (manually) + Screenshots

This is a guide on how to setup Cloudflare CDN with BigRock (similar for Bluehost,Godaddy, Dreamhost, Hostgator) for your website or blog . You can follow the steps below:

Step 1. Create an account with Cloudflare:

Go to https://www.cloudflare.com and click on the “Signup” button.

 

cloudlare signup

Fill in your details, tick on “Agree” and then click on “Create Account“.

cloudflare create account

Step 2. Add your website

Now, in the text box below, type your website address and then click on “Scan DNS Records“as shown below.

cloudflare add site and scan dns

It will take a few moments for the scanning to complete.

 

cloudflare scanning dns records

Once, the scanning is complete, click on “Continue“.

 

cloudflare dns scanning complete

Now, click on “Continue” in the bottom corner:

cloudflare click continue

 

 

Step 3. Select Cloudflare Plan

Now, select the “Free Website” package as shown below and click on “Continue“.

 

select cloudflare free plan

Step 4. Get new name servers

Now, you will see the Cloudflare name servers as shown below. [This may vary for your website]

cloudflare name servers

As you see, for my website it is requesting to change the name server from

dns1.bigrock.in to linda.ns.cloudflare.com
dns2.bigrock.in to rob.ns.cloudflare.com

Also, also to remove the following nameservers:

dns3.bigrock.in 
dns4.bigrock.in 

[Note: The nameservers that you may see in your screen may be different.]

Step 4: Change your name servers to Cloudflare

Now, open up a new tab and login to your domain host panel (i.e. from where you bought your domain name from eg BigRock, Goddady, Hostgator, Bluehost etc). I have my domain from BigRock so I will be loggin in to my Bigrock account.

domain hosting bigrock login

Now, click on the domain you need to change the name servers to.

 

bigrock select domain

Now, click on “Name Servers” 

 

bigrock manage name servers

 

 

And you will see your default nameservers as shown below:

default bigrock name servers

Now, change your nameserver to the ones provided by cloudflare. In my case, after changing the nameserver, it will look like this:

 

cloudflare nameservers update

Now, click on “Update Name Servers“.

domain bigrock nameserver change success

Step 5: Verify in Cloudflare

Now, go back to your cloudflare tab and click on “Continue“.

cloudflare dns nameserver

It should show you show you a green banner with the status: “Active” as shown below.

 

cloudflare cdn active status[NOTE: If you the status does not show as “Active” then you can click on “Recheck Status” and it then should show that its “Active”]

[IMPORTANT: It would take about 24-48 hours for the DNS to get updated.]

And Voila! You have successfully configured Cloudflare CDN for your blog/website and should load faster.

Do check the  performance of your website after 24-48 hours and let me know in the comments sections below if there was any speed improvement.

If this article helped you, then support us by liking us  us on FacebookTwitterGoogle+ and  Tumbler. 🙂

Regards,
ΞXΤЯ3МΞ