Category Archives: Apache

PCRE limits exceeded FIX

When ModSecurity is in use, you may come across error like: Execution error – PCRE limits exceeded (-8): (null) in apache error log.


To fix this error, refer to following steps:

1. SSH the server as root and chnage the directory to apache onfiguration.

cd /usr/local/apache/conf

touch pcre_modsecurity_exceeded_limits.conf

2. Add following contents to the file.

SecPcreMatchLimit 150000
SecPcreMatchLimitRecursion 150000


3. Change file permission to 600

chmod 600 /usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf

4. edit mod_security configuration file.

On cpanel server it’s /usr/local/apache/conf/modsec2.user.conf

5. look for line <IfModule mod_security2.c> and add below line just below the it.

Include “/usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf”


6. Restart apache service.

/etc/init.d/httpd restart

That’s all 🙂

Post to Twitter

Install mod_xsendfile

What is mod_xsendfile ?

mod_xsendfile is a apache2 module that processes x-sendfile headers registered by the original output handler.

This process will speed up your private file transfers.


How to install mod_xsendfile  on Linux server?


1) Login to server as root

2) Download file mod_xsendfile.c from HERE

3) execute command

#apxs -cia mod_xsendfile.c

4) Restart apache server.

Post to Twitter

Redirect error page

How to redirect error page ?

If you wish to redirect 404 error page to main domain or another custome page do following.

1) Create a .htaccess file in document root of your domain and and add following code.

#will redirect 404 error page to your domain.
ErrorDocument 404

#Add following line if you want to redirect page to specific page
ErrorDocument 404     /404_redirect.php

Note: Replace wiuth your actual domain name.
File 404_redirect.php should be present under document root  of domain.  you can create file 404_redirect.php with your design.

Similearly you can replace ErrorDocument number i.e 404 with other numbers as well.

Post to Twitter

Check current apache modules

You can check apache modules by using following command:

/usr/local/apache/bin/httpd -l


httpd -l

Above command will list all current apache module installed ons server .



Post to Twitter

How to add wild card DNS

In wild card DNS anything.domainname will show the domain name page.

A wild-card character is similar to a wild card in a card game, which may represent any other card in the deck.

For eg accessing xyz.domainname.tld will show domainname page. Following are the steps to set wild card DNS.

1) Edit domainname.db file with your favourit editor.

nano /var/named/domainname.db

; Modified by Web Host Manager
; Zone File for domainname
$TTL 14400
@ 86400 IN SOA (
)          86400           IN             NS             86400           IN             NS                                      IN                                IP(ip assigned to your domain)
localhost.                                                                 IN                                14400           IN                MX 0
mail                                                    14400          IN                CNAME
www                                                   14400          IN                 CNAME

ftp                                                        14400           IN                IP(ip assigned to your domain)
* 14400        IN              IP(ip assigned to your domain)

2) Save and exit from file and restart named service

/etc/init.d/named restart

3) You will also need to make entry in the virtual host file.

nano /etc/httpd/conf/httpd.conf

ServerAlias *
DocumentRoot /home/user/public_html
BytesLog domlogs/
User user
Group user
CustomLog /usr/local/apache/domlogs/ combined
ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/

4) Save and exit from file and restart httpd service.

/scripts/restartsrv httpd

Post to Twitter