title: How to set up realip module in nginx
body: <p>I want to use http_realip_module in nginx and Cloudflare. <code>nginx -V</code> returns  </p>
  
  <pre><code>built with OpenSSL 1.1.0d  26 Jan 2017 (running with OpenSSL 1.1.0e  16 Feb 2017)  
  TLS SNI support enabled  
  configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-F3HeH5/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/ngx_http_substitutions_filter_module
  </code></pre>
  
  <p>As you can see there is <code>--with-http_realip_module</code>.<br>
  <code>/etc/nginx/modules-available</code> is empty, <code>/etc/nignx/modules-enabled</code> returns</p>
  
  <pre><code>razem 24K
  drwxr-xr-x 2 root root 4,0K kwi 23 15:58 ./
  drwxr-xr-x 8 root root 4,0K kwi 23 19:53 ../
  lrwxrwxrwx 1 root root   57 kwi 23 15:58 50-mod-http-auth-pam.conf -&gt; /usr/share/nginx/modules-available/mod-http-auth-pam.conf
  lrwxrwxrwx 1 root root   56 kwi 23 15:58 50-mod-http-dav-ext.conf -&gt; /usr/share/nginx/modules-available/mod-http-dav-ext.conf
  lrwxrwxrwx 1 root root   53 kwi 23 15:58 50-mod-http-echo.conf -&gt; /usr/share/nginx/modules-available/mod-http-echo.conf
  lrwxrwxrwx 1 root root   54 kwi 23 15:58 50-mod-http-geoip.conf -&gt; /usr/share/nginx/modules-available/mod-http-geoip.conf
  lrwxrwxrwx 1 root root   61 kwi 23 15:58 50-mod-http-image-filter.conf -&gt; /usr/share/nginx/modules-available/mod-http-image-filter.conf
  lrwxrwxrwx 1 root root   60 kwi 23 15:58 50-mod-http-subs-filter.conf -&gt; /usr/share/nginx/modules-available/mod-http-subs-filter.conf
  lrwxrwxrwx 1 root root   62 kwi 23 15:58 50-mod-http-upstream-fair.conf -&gt; /usr/share/nginx/modules-available/mod-http-upstream-fair.conf
  lrwxrwxrwx 1 root root   60 kwi 23 15:58 50-mod-http-xslt-filter.conf -&gt; /usr/share/nginx/modules-available/mod-http-xslt-filter.conf
  lrwxrwxrwx 1 root root   48 kwi 23 15:58 50-mod-mail.conf -&gt; /usr/share/nginx/modules-available/mod-mail.conf
  lrwxrwxrwx 1 root root   50 kwi 23 15:58 50-mod-stream.conf -&gt; /usr/share/nginx/modules-available/mod-stream.conf  
  </code></pre>
  
  <p>I have configuration from Cloudflare <a href="https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-" rel="nofollow noreferrer">right there</a>, but I don't know where to put it. Do I have to create config? Where, how should I name it?</p>