• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Nginx ngx_http_realip_module for Plesk?

HostaHost

Regular Pleskian
Any chance of getting the Nginx ngx_http_realip_module module for the version of nginx included in Plesk 12 on CentOS 6 & 7? We have customers using Cloudflare who want the real IP in their logs from the requests handled by nginx; we can do the cloudflare mod to handle the requests apache sees.
 
Last edited:
http://nginx.org/en/docs/http/ngx_http_realip_module.html

We have it already:

[root@ppu12-0 ~]# nginx -V
nginx version: nginx/1.9.4
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/share --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --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 --user=nginx --group=nginx --with-ipv6 --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/usr/share/passenger/ngx_http_passenger_module
 
Hi, IgorG is correct however the configuration does not include ALL of the CloudFlare IP addresses, I simply added them. You can find more information here: https://support.cloudflare.com/hc/e...-do-I-restore-original-visitor-IP-with-Nginx-
vi /etc/nginx/conf.d/cloudflare.conf

# $remote_addr rewriting in case of NGINX behind CloudFlare.
# See also mod_cloudflare Apache module configuration.
#CloudFlare
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.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 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
real_ip_header CF-Connecting-IP;

You will also want to edit your Apache conf for Cloudflare

vi /etc/httpd/conf.d/cloudflare.conf

LoadModule cloudflare_module modules/mod_cloudflare.so

<IfModule mod_cloudflare.c>
CloudFlareRemoteIPHeader CF-Connecting-IP
# CloudFlare IP Ranges. For definitive IP range lists see https://www.cloudflare.com/ips-v4 and https://www.cloudflare.com/ips-v6.
# See also /etc/nginx/conf.d/cloudflare.conf if you have NGINX enabled. Please don't use DenyAllButCloudFlare option in this case.
CloudFlareRemoteIPTrustedProxy 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 104.16.0.0/12 108.162.192.0/18 141.101.64.0/18 162.158.0.0/15 172.64.0.0/13 173.245.48.0/20 188.114.96.0/20 190.93.240.0/20 197.234.240.0/22 198.41.128.0/17 199.27.128.0/21 2400:cb00::/32 2405:8100::/32 2405:b500::/32 2606:4700::/32 2803:f800::/32
</IfModule>

Then finish up with a:
service nginx restart
service httpd restart
 
Back
Top