cPanel: How to install mod_geoip

There are many ways to install mod_geoip in the web but the easiest way to compile it with cPanel server is to compile it through the easyapache.

To get it done, run the following command as root,

cd /var/cpanel/easy/apache/custom_opt_mods/
wget http://docs.cpanel.net/twiki/pub/EasyApache3/CustomMods/custom_opt_mod-mod_geoip.tar.gz
tar -zxf custom_opt_mod-mod_geoip.tar.gz

Next compile it with easyapache,

/scripts/easyapache

Then select the Mod_GeoIP in the Short Options List.

cPanel: Howto Resize tmp

This article will guide you how to resize the tmp drive from your cPanel server.

To get rid of /tmp drive keep on full, you may follow the following step,
1.  Stop the following services,

service httpd stop
service mysql stop

2. Un-mount the following drive

umount /var/tmp
umount /usr/tmp (if you are using VPS)
umount /tmp

3. Remove the temporary space

rm -f /usr/tmpDSK

4. Assign the tmp drive space (in bytes).

replace 512000 [value] -- /scripts/securetmp

Assign /tmp to 1GB
eg. replace 512000 1024000 -- /scripts/securetmp

5. Execute and apply it.

/scripts/securetmp

6. Start the services again,

service mysql start
service httpd start

 

cPanel: How to disable mod_security2 for account or path

To disable mod_security2 from cPanel server,

1. Create the following folder.

/usr/local/apache/conf/userdata/std/2/username/domain.com

2. Create a file name disabled_modsec2.conf in the above path.
3. Enter the following line if you want to disable mod_security2 for whole domain.

<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>

For specific path,

<LocationMatch your_path>
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
</LocationMatch>

4. Run the following script from root access.

/scripts/ensure_vhost_includes –user=username

 Alternatively,
Edit the following file,

/usr/local/apache/conf/modsec2.conf

Enter the information below,

SecRule SERVER_NAME "domain.com" phase:1,nolog,allow,ctl:ruleEngine=off

Replace the domain.com will do.

cPanel: Accessing cPanel through a firewall with cPanel Proxy

By default, cPanel, WHM and Webmail using custom port instead of port 80. Hence, you might not able to access to the cPanel, WHM and webmail through a firewall enabled network such as company, University or public network.

To get this issue fixed with cPanel 11.x and later, you may enable cPanel Proxy which is designed by cPanel to allow you access through normal web port 80.

To enable cPanel Proxy, make sure that you have the following setting enabled in WHM-> Tweak Settings.

– Proxy subdomains
– Proxy subdomain creation
– Proxy subdomain override

To enable proxy domain on account wide,

/scripts/proxydomains –user=<username> add

where username is the cPanel username.

To enable proxy domain on a single domain,

/scripts/proxydomains –domain=<domain.com> add

where domain.com is your domain name such as mickgenie.com

Lastly, to remove the proxy domain, change the “add” to “remove”.

cPanel: Database size is Zero

Wonder why cPanel database size is not calculated and it is always showing zero (0) in the database section?

You may fix this by 2 options,
Option 1:
1. Log into WHM(Web Host Manager).
2. Go to Server Configuration and look for Tweak Settings.
3. Look for “Include databases in disk usage calculations” and enable it.
4. Save it.

Option 2:
1. Log into SSH.
2. Open the file named /var/cpanel/cpanel.config.
vi /var/cpanel/cpanel.config
3. Search “disk_usage_include_sqldbs” and change the value to 1.
4. Lastly, run the command as below,
/scripts/update_db_cache

cPanel: Uninstall CloudLinux

It is not hard to install CloudLinux, but you will found more step to uninstall it.

Before you convert CloudLinux back to normal Centos, you shall check if your box come with CloudLinux,
/usr/local/cpanel/bin/cloudlinux_system_install -c

1. Update CentOS RPMs.
yum upgrade -y
2. Rebuild Apache
/usr/local/cpanel/scripts/easyapache –build
3. Reinstall a non-CloudLinux kernel.
yum –disableexcludes=all install kernel
4. Remove the CloudLinux-provided kernel.
rpm -qa |awk ‘/^kernel.*lve/ {print $1|”xargs yum -y erase”}’ Continue reading cPanel: Uninstall CloudLinux

cPanel: Assigned dedicated IP to subdomain

You might want to assign dedicated IP to your subdomain for some reason such as apply SSL to your subdomain.

If you are using cPanel and wish to set dedicated IP to your subdomain, you will find no else where to do that.

However, this could still be able to fix as this article.

Scenario,
– You have domain domain.com and subdomain blog.domain.com.
– You wish to set dedicated IP for blog.domain.com which originally 100.100.100.100 and result as blog.domain.com resolve to 10.0.0.1.

Continue reading cPanel: Assigned dedicated IP to subdomain

How to convert cPanel to CloudLinux

CloudLinux which used to promise to improve server stability, increase server density, decrease support costs and compatibility.

If you are using cPanel and would like to convert to CloudLinux, use the step as below.

1. First of all, you shall use at least CentOS 5 and above.
2. Get the license key from cPanel or CloudLinux.
3. Run the command as below from SSH.

# wget http://repo.cloudlinux.com/cloudlinux/sources/cln/cpanel2cl
# sh cpanel2cl -k
# reboot
# /scripts/easyapache --build

tailwatchd failed: A restart was attempted automagically

If you have cPanel with your server, you might get the following error.

tailwatchd failed @ Tue Jan 1 00:00:00 2010. A restart was attempted automagically
Service Check Method: [check command] tailwatchd is not running

However, you do not need to worry on it as it might be cPanel services stopped or restarted.

To understand in detail, you may execute the command as below from your Shell.
tail -f /usr/local/cpanel/logs/tailwatchd_log

To fix it, you may try to execute the command as below.
/usr/local/cpanel/libexec/tailwatchd –status

Then restart the cPanel services.
service cpanel restart

If the issue still not fix, may update cPanel,
/scripts/upcp –force