Configuration issue with HttpRealipModule (CloudFlare) in nginx configuration file

Posted by Tyrx on Server Fault See other posts from Server Fault or by Tyrx
Published on 2012-10-25T03:14:23Z Indexed on 2012/10/25 5:06 UTC
Read the original article Hit count: 518

Filed under:
|
|

I've been attempting to use HttpRealipModule with the CloudFlare IP range in my main nginx configuration file but upon restarting nginx I'll just get a standard `"configuration file /etc/nginx/nginx.conf test failed" and my site will go down.

This is what I've been attempting to do with my nginx.conf;

    user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {

    # Basic Settings
  set_real_ip_from   204.93.240.0/24;
  set_real_ip_from   204.93.177.0/24;
  set_real_ip_from   199.27.128.0/21;
  set_real_ip_from   173.245.48.0/20;
  set_real_ip_from   103.22.200.0/22;
  set_real_ip_from   141.101.64.0/18;
  set_real_ip_from   108.162.192.0/18;
  set_real_ip_from   190.93.240.0/20;
  set_real_ip_from   188.114.96.0/20;
  set_real_ip_from   2400:cb00::/32;
  set_real_ip_from   2606:4700::/32;
  set_real_ip_from   2803:f800::/32;
  real_ip_header     CF-Connecting-IP;
    client_max_body_size 50m;
    client_header_timeout 5;
    keepalive_timeout 5;
    port_in_redirect off;
    sendfile on;
    server_tokens off;
    server_name_in_redirect off;
    tcp_nopush on;
    tcp_nodelay on;
    types_hash_max_size 2048;

    # MIME
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    # Logging Settings
    access_log  /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log warn;

    # Gzip Settings
    gzip on;
    gzip_disable    "msie6";
    gzip_min_length 1400;
    gzip_types      text/plain text/css text/javascript text/xml application/x-javascript application/xml application/xml+rss;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

What's wrong with that configuration file?

© Server Fault or respective owner

Related posts about nginx

Related posts about configuration