Plesk

How to disable IP address logging in Plesk for Linux

Question

Web statistics tools operate by processing information from log files, including visitors' IP addresses. How to disable IP address logging in case this is considered a GDPR violation?

Answer

To ensure that the server is GDPR compliant without disabling web statistics completely, disable IP address logging. But this way, the quality of statistics reports will decrease.

Note: if IP address logging is disabled, security tools like Fail2ban will stop working. Consider the implications of both options before decision is made.

Disabling IP address logging in Apache

  1. Login to Plesk via SSH
  2. Create a custom templates directory:

    # install -m 0755 -d /usr/local/psa/admin/conf/templates/custom

  3. Copy server template to the custom directory:

    # cp -f /usr/local/psa/admin/conf/templates/default/server.php /usr/local/psa/admin/conf/templates/custom/

  4. Modify the log format replacing '%a' with '-':

    # perl -pi -e ‘s,%a,-,g/’ /usr/local/psa/admin/conf/templates/custom/server.php

  5. Reconfigure Apache:

    # plesk sbin httpdmng --reconfigure-all

Disabling IP address logging in Nginx

  1. Login to Plesk via SSH
  2. Create a file named /etc/nginx/conf.d/aa900_logs_without_ip.conf with the following content:

    log_format noip '- - $remote_user [$time_local]'
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent"';

  3. Create custom templates directory:

    # install -m 0755 -d /usr/local/psa/admin/conf/templates/custom/domain

  4. Copy original template to the custom directory:

    # cp  -f /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/

  5. Find a string beginning with 'access_log' and add 'noip' to the end of the string (before semicolon), so that it looks like this:

    # access_log "<?php echo $VAR->domain->physicalHosting->logsDir . '/' .($OPT['ssl'] ? 'proxy_access_ssl_log' : 'proxy_access_log') ?>" noip;

  6. Reconfigure the web server:

    # plesk sbin httpdmng --reconfigure-all

Additional information

If it is needed to completely disable the web statistics, check the article below:

How to disable web statistics in Plesk

Exit mobile version