I just put one of my sites behind Cloudflare and the visitor IP logged is always a Cloudflare IP, I followed this guide https://support.cloudflare.com/hc/en-us/articles/360029696071 but no change, my server was installed using this guide https://www.howtoforge.com/perfect-server-debian-10-buster-apache-bind-dovecot-ispconfig-3-1/ Any ideas? Thanks
You'll probably have to alter the LogFormat in the apache ispconfig.conf file in the way the tutorial from Cloudflare describes it. But this will affect all sites.
Logging is done for all sites centrally by vlogger. Yes, but as mentioned above, changing this will change logging for all sites on your server.
What I mean is, in what way will affect all sites? will sites not behind Cloudflare stop logging or log differently? Also is this the correct path for site configuration as step 2? /etc/apache2/sites-available/000-default.conf or should I edit mydomain.conf ?
All other sites will probably have no or wrong IP addresses in their logs. This file contains the LogFormat which is used by all sites. Individual sites have no LogFormat settings as logging is done centrally by vlogger.
I can't get this working, etc/apache2/sites-available/000-default.conf looks ike this Code: <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html RemoteIPHeader CF-Connecting-IP # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet And top few lines of etc/apache2/sites-available/ispconfig.conf look like this Code: ################################################ # ISPConfig Logfile configuration for vlogger ################################################ SetEnvIf Request_URI "^/datalogstatus.php$" dontlog LogFormat "%v %a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog Only changed the %h to %a, I have added the file /etc/apache2/conf-available/remoteip.conf Rebooted the server and purged the Cloudflare cache, stuck now
Sorry, the only file you have to alter is /etc/apache2/sites-available/ispconfig.conf Might even be that the apache module you use is not working with piped logging scripts like blogger. I never use that module, so I can't say for sure.
So ignore step 2? https://support.cloudflare.com/hc/e...-Option-2-Installing-mod-remoteip-with-Apache
Yes, step 2 is when you have only one website on the server which is located in /var/www/html folder.
Tried still same, thinking about it is the line from step 2 "RemoteIPHeader CF-Connecting-IP" not need to read the IP list created in step 4?
Got it working The Cloudflare guide said add this /etc/apache2/conf-available/remoteip.conf it shoud be /etc/apache2/conf-enabled/remoteip.conf I have tried with and without step 2 just to satisfy my curiosity and of course you are right Till Thanks for your help