title: Nginx and Cloudflare with shoutcast get real ip's
body: <p>So I currently have a server running with nginx on it and shoutcast. I'm running <code>Ubuntu 16.04.4 LTS (GNU/Linux 3.13.0-52-generic x86_64)</code>.</p>
  
  <p>Using cloudflare I link a subdomain (using an A record) to my IP. That subdomain is proxied to mypi:8000 to access the shoutcast verver, using that domain.</p>
  
  <p>Now, I get on shoutcast the plain IP on the server for every connected client, so every IP is the same nad I can't have unique listeners.</p>
  
  <p>Here is my Nginx config:</p>
  
  <pre><code>##
  # Default server configuration
  ##
  
  server {
          listen 80;
          listen [::]:80 default_server ipv6only=on;
          listen 443 ssl http2;
  
          ssl on;
          ssl_certificate /etc/nginx/ssl/cert.pem;
          ssl_certificate_key /etc/nginx/ssl/key.pem;
  
  
          root /usr/share/nginx/html;
          index index.php index.html index.htm;
  
          server_name rallypodium.be www.rallypodium.be;
  
          if ($http_host = rallypodium.be){
                  rewrite  (.*)  https://www.rallypodium.be$1;
          }
  
          location / {
                  try_files $uri $uri/ /index.php?$query_string;
          }
  
          error_page 404 /404.html;
  
          error_page 500 502 503 504 /50x.html;
          location = /50x.html {
                  root /usr/share/nginx/html;
          }
  
          # pass the PHP scripts to FastCGI server listening on the php-fpm socket
          location ~ \.php$ {
                  fastcgi_cache phpcache; # The name of the cache key-zone to use
                  fastcgi_cache_valid 200 30m; # What to cache: 'Code 200' responses, for half an hour
                  fastcgi_cache_methods GET HEAD; # What to cache: only GET and HEAD requests (not POST)
                  add_header X-Fastcgi-Cache $upstream_cache_status; # Add header so we can see if the cache hits or misses
  
                  try_files $uri $uri/ /index.php?$query_string;
                  fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                  fastcgi_index index.php;
                  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                
                  include fastcgi_params;
  
          }
  
  }
  
  ##############################################################
  # SHOUTCAST SERVER CONFIGURATION
  ##############################################################
  
  server {
          listen   80;
          listen [::]:80;
          listen 443 ssl http2;
          server_name stream.rallypodium.be;
  
          location / {
                  proxy_pass http://serverip:8000;
                  proxy_set_header X-Real-IP $remote_addr;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          }   
  }
  </code></pre>
  
  <p>The serverIP is the same IP as where nginx runs on. So "localhost" here... Any ideas? I already tried to add <code>set_real_ip_from</code> with all the CF Ip's and then add <code>real_ip_header     CF-Connecting-IP;</code>, but that doesn't seem to work... </p>