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 startup script at the beginning.
Enter the following line at the beginning of the script.
ulimit -n 65536
Save the file and restart apache