web analytics

Monthly Archives May 2013

htaccess pcfg_openfile: unable to check htaccess file

I was getting random forbidden errors on one of my websites one day. It appears and disappears and was not getting an idea as to what had happened. Upon checking the apache error log, I noticed the following error.

[Thu May 16 23:38:13 2013] [crit] [client x.x.x.x] (24)Too many open files: /var/www/vhosts/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://abc.com/blog/%20abcd?ades

Normally it happens due to the open files exceeding the limit. I tried the following and that fixed it.

1) A simple restart of apache fixed it all of a sudden.

2) Try ulimit -a as root and  check for “open files”. The default value will be 1024. Try raising it to 4096 as follows.

ulimit -n 4096

3) Also, you can raise this limit for apache by giving it in apache star...

Read More

Install Mod_evasive to prevent DOS attacks

Version Installed :- 1.10.1


  1. cd /usr/local/src

  2. tar –xzvf mod_evasive_1.10.1.tar.gz

  3. cd mod_evasive/

  4. Take a backup of the apache conf, as it needs to be modified


cp –pv /usr/local/apache/conf/httpd.conf httpd.conf.beforeevasive_bak.$(date +%F)


  1. /usr/local/apache/bin/apxs –cia mod_evasive20.c

  2. Add the following to httpd.conf now from WHM-> Apache Configuration -> Include Editor -> Post Virtual Host Include


<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 600


  1. Restart apache – /etc/rc.d/init.d/httpd restart

Read More

Install Pagespeed in cpanel server

Version Installed :




Pagespeed requires deflate module, so that should be compiled already with 


Once deflate is enabled, do the following.


  1. cd /usr/local/src

  2. Check if the server is 32 bit or 64 bit and then download the corresponding pagespeed rpm. You can check it by issuing any of the following commands.


uname –m




getconf LONG_BIT


  1. mkdir mod-pagespeed

  2. cd mod-pagespeed

  3. rpm2cpio ../mod-pagespeed-beta_current_x86_64.rpm | cpio –idmv

  4. cp etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

  5. cp usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/

  6. chmod 755 /usr/local/apache/module...

Read More