How to delete “some file” files from all accounts

Let’s use the error log for this example but you can substitute any file.

The error_log file saves the error logs of a account / user / website. There can be multiple error_log file under one user / account / website.

These error_log files may consume lots of space on your server. Sometimes the size of error_log files are in GB. So, you may want to delete all error_log files to free up some space on server.

Login in server via SSH as root and execute following command:

find /home -type f -name error_log -exec rm -f {} \;

The above command will search for error_log files in /home directory and delete them. Thus it will delete all error_log files under all users / accounts / cPanel accounts / websites.

Note:

1) This command can take lots of time to complete depending on size of your /home directory. Sometimes it may take 10-30 minutes to complete.

2) When required the server will automatically create new error_log files.

WordPress – How to serve static content from a cookieless domain

If you’re serious about optimizing a WordPress website for speed, then you need to setup your website to serve the static content, such as images and CSS files, from a cookieless domain. This will speed up your page loads by reducing unnecessary traffic and distributing the traffic across more two addresses instead of one, working around the limit that browsers place on how many simultaneous requests can be made on each address.

As described by Yahoo!, when the browser requests a static image and sends cookies with the request, the server ignores the cookies. These cookies are unnecessary network traffic.

The steps below detail how to configure your WordPress install to serve static content from a cookieless domain.

Step 1: Create a subdomain using cPanel for the static content

The steps below are for cPanel managed websites. The process may be different depending on the hosting environment for your website.

  1.  Log into the cPanel for your website. The address is usually www.website.com/cpanel, and the username and password would have been provided by your host when you first joined.
  2. Under ‘Domains‘, click on the icon for ‘Subdomains’
  3. WordPress- cPanel Hosting
  4. In the ‘Create a subdomain’ box enter static in the ‘Subdomains field and in the ‘Document Root’ field enter the path to the wp-content folder, for example /public_html/wp-content
  5. subdomain
  6. Click on the ‘Create’ button and wait for confirmation that the subdomain has been created
  7. You will now be able to open static.domainname.com and see a blank page

Step 2: Configure WordPress

  1. Using your preferred method, for example FTP or through the cPanel, navigate to the root directory of your WordPress installation and edit wp-config.php
  2. Add the following lines to the top of the file, below the <?php
  3. Replace domainname with the domain name for your website
  4. define("WP_CONTENT_URL", "http://static.domainname.com");
    define("COOKIE_DOMAIN", "www.domainname.com");
    define("WP_PLUGIN_URL", "http://www.domainname.com/wp-content/plugins");
  5. Save the changes to wp-config.php

Step 3: Update existing post content

Now WordPress is configured to serve the static content in wp-content through the static subdomain.

New images added to posts will now automatically use the static subdomain, however existing image paths need to be updated to use the static domain.

  1. Log into the cPanel again
  2. Under ‘Databases’, click on the icon for ‘phpMyAdmin’
  3. Expand the database for the WordPress installation and click on the posts table
  4. Click on the ‘Inline’ link, then in the text box enter the following command
  5. Replace domainname with the domain name for your website
  6. UPDATE wp_posts SET post_content = REPLACE(post_content,
    'http://www.domainname.com/wp-content/uploads/','http://static.domainname.com/uploads/')
  7. Click ‘Go’ to apply the changes
  8. From the WordPress admin, check a few existing posts to make sure images are loading from static.domainname.com

And you’re done – one step closer to WordPress speed perfection!

OPTIONAL: Additional step if your theme uses font awesome icons

If your theme uses font awesome for icons, such as a ‘home’ or ‘search’ icon – you will need to add the following to your .htaccess file to allow the icons to continue to work.

Replace domainname with the domain name for your website

## EXPIRES CACHING ##

# ——————————————————————————
# | CORS-enabled images |
# ——————————————————————————

<FilesMatch “\.(cur|gif|ico|jpe?g|png|svgz?|webp)$”>
SetEnvIf Origin “:” IS_CORS
Header set Access-Control-Allow-Origin “http://www.domainname.com” env=IS_CORS

# ——————————————————————————
# | Web fonts access |
# ——————————————————————————

# Allow access from all domains for web fonts

<FilesMatch “\.(eot|otf|ttc|ttf|woff)$”>
Header set Access-Control-Allow-Origin “http://www.domainname.com”[:]

Nameserver software version

You did a DNS check and received the below warning message, not to worry.

One or more nameservers responded to version queries. This can be considered a breach of security. If a malicious person or program had access to a version-specific exploit for your DNS server, displaying the version info openly will make their attack much easier. This should be removed or obscured. The nameservers that responded to version queries are

Follow these simple steps to resolve.

  • Login to Shell as the root user of your server or VPS.Open your named configuration file:
    vi /etc/named.conf
  • Look for the options section, that looks something like this:

// Put files that named is allowed to write in the data/ directory:
directory “/var/named”; // the default
pid-file “/var/run/named/named.pid”;
dump-file “data/cache_dump.db”;
statistics-file “data/named_stats.txt”;
/* memstatistics-file “data/named_mem_stats.txt”; */
allow-transfer {“none”;};
};

  • Add this to the end so it looks the same as below: version “N/A”;
  • // Put files that named is allowed to write in the data/ directory:
    directory “/var/named”; // the default
    pid-file “/var/run/named/named.pid”;
    dump-file “data/cache_dump.db”;
    statistics-file “data/named_stats.txt”;
    /* memstatistics-file “data/named_mem_stats.txt”; */
    allow-transfer {“none”;};
    version “N/A”;
    };

  • Then save the file and restart BIND

Run another DNS test, the only thing that will be reported is what you put in the quotes.

If you have a VPS, or Dedicated Server with IDC Thailand and would like a representative to perform this for you, please contact support.

Tagged

Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/idcthail/public_html/wp-includes/functions.php on line 3729