Author Archive for mypapit

How to find cause of heavy usage on your Apache webserver

Here’s a quick and dirty tips on how to find cause of heavy CPU resources usage on your Apache webserver (especially when running php scripts).

First you need to locate the Apache 2 “access.log” file. By default in Ubuntu, this file is located in “/var/logs/apache2″ directory.

Then you need to run this command to find out which IP address accesses your website the most in a short time.

CODE:

  1. tail -10000 access.log| awk ‘{print $1}’ | sort | uniq -c |sort -n

The output of the command should contain a list of IP addresses along with the number of hits it made in the last 10,000 access of your website

CODE:

  1. 47 117.58.252.98
  2.      81 202.124.242.186
  3.      84 202.124.245.26
  4.     182 194.164.101.217
  5.     220 208.101.22.146
  6.     225 72.167.131.144
  7.    3946 93.135.xxx.xxx

From here you can easily locate the offending ip address and proceed to block it from accessing your website further using .htaccess file or other blocking method.

Here is an example to block certain ip address from accessing your website using .htaccess file

CODE:

  1. <limit GET HEAD POST>
  2.  order deny,allow
  3.  deny from  93.135.xxx.xxx
  4. </limit>

Save .htaccess file in the root directory of your web server (example /var/www), and the ip address wont be available to access your site again.

Hope that would help you!

Preparing Training Materials for Linux Workshop in my workplace

Hey there,

I’m given roughly one month to prepare training material for an in-organization Linux training workshop in my workplace. Target audience are mostly from non-IT background who wished to know more about GNU/Linux based operating system.

I was given freedom to choose any Linux distro that I see fit for the workshop and for that matter I choose Ubuntu as it has an ultra friendly Wubi Installer that would simplify the installation exercise during the training session.

Other than that, i’m still struggling with the materials to be included during the one day (8 hours) workshop aside from Ubuntu installation.

Suggestions from Ubuntu’ers are welcomed as I’m pretty swamped with other work while working on this workshop.