Поскольку я очень ленивый, я просто скопировал текст с инструкцией в случае, если там ее не окажется.
Суть проблемы в том, что при подключении домена на управление Cloudfare (ну если вы нищеброд или принципиально не хотите покупать ssl сертификат за деньги) эта гадость этот прекрасный сервис подставляет свои IP адреса, и это логично, так как по сути он проксирует ваш сайт.
Итог: вы не видите реальных IP пользователей. Ниже как исправить.
mod_remoteip
Overview
Cloudflare no longer updates and supports mod_cloudflare. However, if you are using an Apache web server with an operating system such as Ubuntu Server 18.04 and Debian 9 Stretch, you can use mod_remoteip to log your visitor’s original IP address.
Installing mod_remoteip
As this module was created by an outside party, we can't provide technical support for issues related to the plugin.
To install mod_remoteip on your Apache web server:
1. Enable mod_remoteip by issuing the following command:
sudo a2enmod remoteip
2. Update the site configuration to include RemoteIPHeader CF-Connecting-IP, e.g. /etc/apache2/sites-available/000-default.conf
ServerAdmin webmaster@localhost DocumentRoot /var/www/html ServerName remoteip.andy.support RemoteIPHeader CF-Connecting-IP ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
3. Update combined LogFormat entry in apache.conf
, replacing %h with %a in /etc/apache2/apache2.conf.
For example, if your current LogFormat appeared as follows
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
you would update LogFormat to the following:
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
4. Define trusted proxy addresses by creating /etc/apache2/conf-available/remoteip.conf
by entering the following code and Cloudflare IPs:
RemoteIPHeader CF-Connecting-IP RemoteIPTrustedProxy 192.0.2.1 (example IP address) RemoteIPTrustedProxy 192.0.2.2 (example IP address) (repeat for all Cloudflare IPs listed at https://www.cloudflare.com/ips/)
5. Enable Apache configuration:
sudo a2enconf remoteip Enabling conf remoteip. To activate the new configuration, you need to run: service apache2 reload
6. Test Apache configuration:
sudo apache2ctl configtest Syntax OK
7. Restart Apache:
sudo systemctl restart apache2