Disabling Apache logs
In order to disable Apache logs, you need to edit the Apache configuration files that are included. In different operating systems, they are located in different places.:
Debian/Ubuntu
/etc/apache2/vhosts/<USERNAME>/<DOMAIN.NAME>
CentOS
/etc/httpd/conf/vhosts/<USERNAME>/<DOMAIN.NAME>
In the configuration files, you need to find and comment out the lines
CustomLog /var/www/httpd-logs/example.com.access.log combined
ErrorLog /var/www/httpd-logs/example.com.error.log
By adding a character to the beginning of the line #
#CustomLog /var/www/httpd-logs/example.com.access.log combined
#ErrorLog /var/www/httpd-logs/example.com.error.log
After that, restart Apache.
Debian/Ubuntu
systemctl restart apache2
CentOS
systemctl restart httpd
After these actions, Apache will stop writing logs for all sites. Only its main logs will remain, which will be rotated by system utilities.
Disabling Nginx logs
In order to disable logs in Nginx, you need to edit the Nginx configuration files that are added to the main config (Include). In different operating systems, they are located in different places.:
Debian/Ubuntu/Centos
/etc/nginx/vhosts/<USERNAME>/<DOMAIN.NAME>
In the configuration file, you need to find the Server section for each domain on the server.
In this section, you need to comment out the lines
access_log /var/www/httpd-logs/example.com.access.log
error_log /var/www/httpd-logs/example.com.error.log notice
By adding a character to the beginning of the line #
#access_log /var/www/httpd-logs/example.com.access.log
#error_log /var/www/httpd-logs/example.com.error.log notice
After that, restart Nginx.
Debian/Ubuntu/CentOS
systemctl restart nginx
After these actions, Nginx will stop writing logs for all sites. Only its main logs will remain, which will be rotated by system utilities.
