mod_limitipconn on cPanel

Written by Pravin on October 14, 2008 – 9:45 am -

This installation is for Apache 2.x

Download mod_limitipconn & untar the file. Compile mod_limitipconn with apache using following command.

/usr/local/apache/bin/apxs -cia mod_limitipconn.c

Add following line to /usr/local/apache/conf/httpd.conf, inside a virtual host:

<IfModule mod_limitipconn.c>
<Location />
MaxConnPerIP 5
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
NoIPLimit image/*
</Location>
</IfModule>

Example:

<VirtualHost 192.168.2.5:80>
ServerAlias example.com
ServerAdmin webmaster@example.com
DocumentRoot /home/example/public_html
BytesLog domlogs/example.com-bytes_log
User iowncail
Group iowncail
<IfModule mod_php4.c>
php_admin_value open_basedir “/home/example/:/usr/lib/php:/usr/local/lib/php:/tmp”
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir “/home/example/:/usr/lib/php:/usr/local/lib/php:/tmp”
</IfModule>
ServerName www.example.com
<IfModule mod_limitipconn.c>
<Location />
MaxConnPerIP 3
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
NoIPLimit image/*
</Location>
</IfModule>
User example
Group example
CustomLog /usr/local/apache/domlogs/example.com combined
ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/
</VirtualHost>

Then restart apache service.

The biggest problem here is that when easyapache will be done in the server, the above changes will be overwritten. To avoid this you will have to do following changes.

mkdir -p /usr/local/apache/conf/userdata/std/1/example/example.com

Make a file called custom.conf and in it add.

<Location />
MaxConnPerIP 3
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
NoIPLimit image/*
</Location>

Then run

/scripts/ensure_vhost_includes –user=example

Where example is the account username and example.com is the account example name. Then restart apache.


Tags: , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting, VPS hosting | No Comments »

Leave a Comment

RSS

  • Subscribe Me

  • Tag Cloud

  • Archives