HTTP Compression test for your website

Web servers can support compression of the websites content on server itself. If web servers such as apache is compiled with mod_deflate and configured to compress static files such as html, js, css, images etc your site would load faster.

To test whether your web server is already having compression feature you can use the following link:

If you don’t find the compression support, request your web host for the same.

Fixing php in Ubuntu

Running php scripts on apache in your Ubuntu desktop won’t be sweat at first. You might notice that php scripts start downloading when you start accessing them via browser. This is mainly because of small configuration issues that we can find on machine. If you have enabled userdir module (http://localhost/~yourusername), it contains a line to disable php values as follows in /etc/apache2/mods-enabled/php5.conf :

php_admin_value engine Off

All that you have to do is to disable the above line and restart apache to get php working.

Limit tomcat heap memory usage on cPanel Server

To limit tomcat heap memory usage we normally change the environment variables in tomcat startup scripts. cPanel allows us to take care of this by creating and adding min and max values to a file called  /var/cpanel/tomcat.options (File won’t exist by default).


the “-Xms” initial Java heap size for the application to 100MB, and the “-Xmx” maximum Java heap size to 200MB. If the – is not placed in front of the option when putting the values into /var/cpanel/tomcat.options file that is created, then Tomcat will refuse to startup properly.

This method would be preferred over directly editing /usr/sbin/starttomcat. The /var/cpanel/tomcat.options file would not be edited by cPanel scripts or upon updates.

Fix: fixquota fails with journaled quota support: not available with vzaquota (disabled)

If you’re running cPanel server on a OpenVZ hardware node, you might face issues with quota for few reasons:

1. Secondary quota might not have been enabled on hardware node.

You can verify by checking for “DISK_QUOTA=yes” in /etc/vz/conf/vz.conf

Also, QUOTAUGIDLIMIT needs to be set for the VPS in  /etc/sysconfig/vz-scripts/CT_ID.conf (PS: CT_ID is the container id of the VPS)

2. You should have initialized the quota via WHM.

If you continue to face problem even after applying both fixes, re-initializing quota might help as per  Here is the excerpt:

WHM/Cpanel, a popular commercial web-based control panel for Linux, has a tendency to overwrite the special quota files in the VE context. I am referring to:

lrwxr-xr-x 1 root root 39 Jun 8 17:27 -> /proc/vz/vzaquota/00000073/
lrwxr-xr-x 1 root root 38 Jun 8 17:27 aquota.user -> /proc/vz/vzaquota/00000073/aquota.user

The result of these being overwritten will be WHM showing “unlimited” quota reports for all users in the system. An quick solution to this is to run these commands from within the VE as root:

rm -rf /aquota.user 2>/dev/null
rm -rf / 2>/dev/null
unlink /aquota.user 2>/dev/null
unlink / 2>/dev/null
for x in `find /proc/vz/vzaquota/ | tail -2 `; do ln -s $x / ; done

journled quota support warning didn’t get resolved even after this. Yet to check for the core reason for the same.

Loging Varnish client IP in Apache logs

When you have a varnish server infront of your Apache server, you will be reverse proxying the requests. This will mark your varnish’s servers ip as the client in apache logs. To let apache know the real client’s ip we can user mod_rpaf module needs to be loaded. Use the following steps to install mod_rpaf module on your apache server.

tar xvfz mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
sed -ie ‘s/apxs2/apxs/’ Makefile
make rpaf-2.0
make install-2.0

Once the installation is done, we need to add the following configuration apache configuration file to enable the module.

LoadModule rpaf_module modules/

RPAFenable On
RPAFsethostname On
RPAFheader X-Forwarded-For

RPAFproxy_ips can be multiple IP address and it’s IP from your reverse proxy.


Replace with your varnish servers ips.

Add the following LogFormat to apache configuration file (httpd.conf)

LogFormat “%{X-Forwarded-For}i %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”” varnishcombined

In the VirtualHost entry of your domain use varnishcombined as logformat for access logs.

In varnish (3.0.x) default.vlc file under vlc_recv{} add following lines:

if (req.restarts == 0) {
if (req.http.X-Forwarded-For) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + “, ” + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;

restart apache and httpd to finish with.

You should now start seeing the actual client’s ip in apache logs as well.

Source: varnish, stackoverflow, etc