Delete WDCP Web site logs (nginx or Apache log files)

Source: Internet
Author: User
Tags system log apache log

Today, there is a netizen consultation need to resolve the WDCP panel site environment needs to delete the site and system log files, because the site has been running for more than a year has caused a huge amount of hard disk space occupied by the hard disk, almost full, so you must delete the log. Whether it is a system log or a Web log, sometimes useful, we can view the site's visit and analyze the site's crawler frequency, but most of the time we will not go to see.
Therefore, with the accumulation of time, the log will be more and more large footprint of the VPS host hard disk capacity, we need to deal with the regular. In the WDCP panel, whether we start the Nginx or Apache environment, there are log files in the system, one is the error log, the other is access log.
First, the website log

We need to view the operation of the site, when adding a site, we can open the site log.

If we need to open a log of a site, we need to check or edit the existing site when adding a site, so this site will have generate errors and access logs, we can conduct data analysis. At the same time, the log will appear in the/www/web_logs/directory, the corresponding domain name prefix, we can see Laozuo.org_access_log and laozuo.org_error_log two files.

Second, System log

/www/wdlinux/nginx-1.0.15/logs
/www/wdlinux/httpd-2.2.22/logs

In the above 2 directories, the same will see an error log and an access log.
For the above two parts of the log file, we delete according to the size, if not, we still do not delete, before we delete, we need to stop the web run, in the WDCP panel first shut down the web and MySQL running, delete the log and then open.

For the system log, we can prohibit future generation, the general shutdown effect is not large, if we do not want to close the regular inspection.

A-nginx Log Shutdown method

Sed-i '/log_format/a
Access_log off; '/www/wdlinux/nginx/conf/nginx.conf
B-apache Log Shutdown method
Sed-i ' S#customlog ' logs/access_log ' common#customlog/dev/null common# '/www/wdlinux/apache/conf/httpd.conf

After the build is turned off, we also need to reboot Nginx or Apache.

A-Restart Nginx
/etc/init.d/nginxd restart
B-Restart Apache
/ETC/INIT.D/HTTPD restart

In this way, we can completely solve the problem of log occupancy of the WDCP system. Finally, we check the hard disk's data for free space through df-h.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.