How To Configure Your Server to Log Real Visitor IPs

Getting Started With CloudFlare™

 
Because CloudFlare acts as a proxy, all visits to your website and web applications will, by default, be logged as originating from a CloudFlare IP address — not the visitor’s actual IP address. However, the Apache module mod_cloudflare can be used to ensure that visitors’ actual IP addresses are logged and displayed.

We recommend that you activate mod_cloudflare as outlined in this article to accurately log website visitor IP addresses and prevent unwanted behavior. Without this step, your server’s firewall could block CloudFlare’s IP addresses, making your site inaccessible. If you need to check whether the module is already enabled or need assistance installing it, please open a ticket and Heroic Support® will be happy to help.

Pre-Flight Check

  • This article assumes that you have already set up CloudFlare and added your domain.
  • We’ll be installing the mod_cloudflare module for Apache, and you’ll need root-level SSH access to proceed.
  • If you’re using a web server other than Apache, you’ll need to enable the appropriate module for your web server. For Nginx, you can use the ng_http_realip_module, and an HTTP Module for IIS also is available.

Installing mod_cloudflare on CentOS 6 and CentOS 7 Servers with cPanel

To install mod_cloudflare on a cPanel server running CentOS 6 or CentOS 7, simply yum install our mod_cloudflare package:

yum install lw-mod_cloudflare-cpanel

We built the RPM in a way that does not require you to run EasyApache, because Heroic Support® is what we do 🙂

To confirm that the module has been added to Apache, run this command:

httpd -M | grep -i cloud

Installing mod_cloudflare on Core-Managed CentOS 6 and CentOS 7

To install mod_cloudflare on a core managed (non-cPanel) server running CentOS 6 or 7, simply yum install our mod_cloudflare package!

yum install lw-mod_cloudflare

To confirm that the module has been added to Apache, run this command:

httpd -M | grep -i cloud

Installing mod_cloudflare on Ubuntu/Debian Core-Managed Servers

To install mod_cloudflare on Ubuntu/Debian Core Managed, simply apt-get install our mod_cloudflare package:

apt-get install lw-mod_cloudflare

To confirm that the module has been added to Apache, run this command:

httpd -M | grep -i cloud

Next Step: Get to Know CloudFlare

Now that you’ve got everything configured, it’s time to Explore the CloudFlare dashboard.
 

Be Sociable, Share!
Here's 75 % off, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support