Featured Posts

Using DKIM with Exim and cPanel Similar to the intentions of SPF records and DomainKeys, DKIM is intended to authenticate a sender by using a public/private key pair to digitally sign email, therefore increasing deliverability. At this...

Readmore

Copy Outgoing Email on a cPanel Server with Exim A common request we get is how a user can automatically BCC outgoing email to another address. This is most often requested by law firms that need to be able to retain copies of communication. Forwarding...

Readmore

Do You Care About Your Customers' Data? I was working a case last week for a new client that's been hosting local business websites for over three years. As with all of my case studies, I did a short survey of the client's infrastructure, processes,...

Readmore

Tips to Reduce Your Customer Support Costs When hosting websites, whether as a mainstream hosting provider, a hobby, or to supplement another service, it's your job to make sure your customers have access to technical support in case they need...

Readmore

Roundcube: MySQL or SQLite? cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I've come to the conclusion that SQLite is definitely...

Readmore

The cPanel Admin Rss

Allowing Users to Customize AwStats

Posted by Vanessa | Posted in Misc | Posted on July 21, 2010

0

You can allow users to use their own configuration file for AwStats in case they are in need of customizations not provided by the server’s main config.  To enable this option, add the following to /etc/stats.conf:

allow_awstats_include=1

Alternatively, you can go to WHM > Statistics Software Configuration, and click on Allow Awstats configuration Include file

This will allow users to have an awstats.conf.include file in /home/$username/tmp/awstats, which can be used to override settings from the main AwStats configuration for the server.

Manually Rearranging Accounts

Posted by Vanessa | Posted in Misc | Posted on July 14, 2010

0

There was a situation today where I had to mass-move a bunch of accounts from one partition to another.  WHM’s Rearrange an Account function does this one account at a time, but to move over 50 of them, a more scripted solution was necessary.  Here’s how I did it on a live server without causing any downtime:

Scenario: Moving over 50 cPanel accounts from /home4 to /home3 on a live dedicated server

Step 1: Grab the list of users

Done with a simple one-liner:

for user in `cat /etc/passwd | grep /home/ | cut -d: -f1` ; do echo $user >> /root/users ; done

Step 1: Rsync all the data over

This part can be fairly CPU-intensive, so you may want to bandwidth-limit or renice the rsync which will slow the transfer, even if done locally. You need to copy the data on one disk to the other:

for user in `cat users` ; do rsync -av --bwlimit=8000 --delete /home4/$user /home3 ; done

You may want to run this command a few times depending on how much data is being moved over.

Step 3: Update configuration

Paste the following commands into a file (replacing the partition names with the ones pertaining to your server), chmod 755, and run:

for user in `cat users` ;  do

replace /home4/ /home3/ — /var/cpanel/userdata/$user/*
replace /home4/ /home3/ — /etc/proftpd/$user
replace /home4/$user /home3/$user — /etc/passwd
ln -s /home3/$user /home4/$user
replace /home4/$user /home3/$user — /home3/$user/etc/*/passwd

done

Now, run:

/scripts/rebuildhttpconf && service httpd restart

service pure-ftpd restart (or proftp)

When you’re sure that everything is moved over, you can remove all the user data from the old partition.

Changing The Default Web Templates for cPanel

Posted by Vanessa | Posted in Misc | Posted on July 13, 2010

0

cPanel currently has four templates that are visible to your users:

Default website: Appears to visitors who navigate to a site that points to the server but isn’t configured in Apache
Account move: Appears to visitors who navigate to a site that has moved
Connection selection: Appears to visitors who navigate to a site that is experiencing a connection or firewall problem
Account suspended: Appears to visitors who navigate to a site that has been suspended

You can modify the templates in WHM > Web Template Editor, but what if you have multiple servers you need to update templates for?

The templates are stored in a simple location:

/var/cpanel/webtemplates/$user/$language/$templatename.tmpl

$user : The reseller user (all accounts under this reseller will use its templates)

$language: The language in use for cPanel

$templatename: The name of the template, with .tmpl appended:

Default website: default.tmpl
Account move: moving.tmpl
Connection selection: redirect.tmpl
Account suspended: suspended.tmpl

This way, if you wanted to (for example) change all the suspended pages for accounts owned by root, simply drop your html code into the following file:

/var/cpanel/webtemplates/root/english/suspended.tmpl

The way cPanel works in regards to these templates, is to redirect all sites matching relevant situations (such as suspended websites) to a compiled CGI file in /usr/local/cpanel/cgi-sys:

movingpage.cgi
defaultwebpage.cgi
suspendedpage.cgi
redirect.cgi

The files load up the template and serve them to the visitor reaching the website or cPanel for the account in question.

How to Rebuild cPanel Bandwidth Graphs

Posted by Vanessa | Posted in Misc | Posted on July 1, 2010

0

Cpanel 11.25 restructured the way that bandwidth RRD files are being processed, in that each service has two RRD files – one for peak, and one for rate.  The “peak” file is used for long timespans of a month or longer, and the “rate” file covers a timespan of a week or less.  The following is an example of files that would be created for domain.com:

domain
domain.com.5min
domain.com.hour
domain.com
domain.com.5min
domain.com.hour

Re rebuild the RRD databases for a user, run:

/usr/local/cpanel/bin/rebuildbwrrd <user>

To do this for the entire server:

/usr/local/cpanel/bin/rebuildbwrrd –all

Beware though that cPanel 11.25 requires a  bit more disk space for the new bandwidth graphs, so if you have /var on a separate partition and there won’t be enough room, I recommend doing the following:

mv /var/cpanel/bandwidth /home

ln -s /home/bandwidth /var/cpanel/bandwidth

You’re basically moving the bandwidth graphs to another location and linking them to /var/cpanel/bandwidth.

Roundcube: MySQL or SQLite?

Posted by Vanessa | Posted in Misc | Posted on June 7, 2010

3

cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I’ve come to the conclusion that SQLite is definitely the best way to go for Roundcube. Having trouble making the decision? This article may help clear things up for you.

Managing Multiple Hard Drives with cPanel

Posted by Vanessa | Posted in Misc | Posted on June 6, 2010

3

If you have a server with single standalone drives, you may have considered the possibility of adding additional hard drives to provide more disk capacity to your system. Luckily, this is very easy to set up and use with cPanel.

First things first, I’ll assume that you already have the hard drive physically installed in your system. This guide will show you how to partition, format, and configure cPanel to use an additional hard drive, in the simplest way possible.

Changing the Shared IP Address of a Live Server

Posted by Vanessa | Posted in Misc | Posted on June 4, 2010

3

There may come a point in time where you need to change the shared IP address of a server, with little to no interruption in service for your users.

This guide will show you how to change the shared IP of your cPanel server with the method I’ve used in the past. This is intended for intermediate to advanced administrators that have some basic knowledge of cPanel and networking.  This will only update the main IP of your server, and will not affect accounts that have dedicated IPs or SSL certificates.

Accessing cPanel Through A Firewall

Posted by Vanessa | Posted in Misc | Posted on May 23, 2010

0

There’s been a long-standing issue from a hosting provider’s point of where cPanel runs on abnormal ports, causing users behind firewalls to be unable to access cPanel. At first, there was cpanelproxy.net which offered (at that time) an automated script that users could install on their hosting accounts to route cPanel traffic over port 80. Around the time that cPanel 11 came out, the script no longer worked, and users behind corporate or school firewalls were out of luck.

cPanel 11 introduced its own proxy to allow users to get around firewall restrictions.

To enable this feature without inconveniencing users, check these three options in WHM > Tweak Settings:

Add proxy VirtualHost to httpd.conf to automatically redirect unconfigured cpanel, webmail, webdisk and whm subdomains to the correct port (requires mod_rewrite and mod_proxy)

Automatically create cpanel, webmail, webdisk and whm proxy subdomain DNS entries for new accounts. When this is initially enabled it will add appropriate proxy subdomain DNS entries to all existing accounts. (Use /scripts/proxydomains to reconfigure the DNS entries manually)

Allow users to create cpanel, webmail, webdisk and whm subdomains that override automatically generated proxy subdomains

*Keep in mind that if you’re establishing these settings on an existing server, it’s going to update the zones for each domain on the server and synchronize them out to the DNS cluster. This got us in trouble once, as we had a number of suspended accounts on a server that ended up having their DNS reverted back when the proxy subdomains were updated.

To enable proxydomains for the whole server:

/scripts/proxydomains add

To enable for all domains on one user’s account:

/scripts/proxydomains –user=<user> add

To enable for a single domain:

/scripts/proxydomains –domain=<domain> add

To remove proxy domains, use the same commands as above, only use “remove” instead of “add”. From here, you can access the proxy at http://cpanel.domain.com (or webmail/whm, respectively), or access cPanel normally and let it detect whether you are behind a firewall.

Installing A Wildcard SSL Certificate

Posted by Vanessa | Posted in Misc | Posted on May 18, 2010

2

A wildcard ssl basically allows you to use unlimited subdomains on a given domain name with one SSL certificate.  A user will need to purchase a wildcard SSL from a vendor that supplies them.

Similar to having multiple certificates installed on a server, each subdomain containing the certificate needs its own IP as well.  Wildcard SSL’s do not work like Wildcard DNS – you really do have to specifically install the certificate on each subdomain. Here are two methods to setting up Wildcard certificates for a domain.

Multiple Accounts

In this scenario, you’d have each subdomain hosted as a separate cPanel account, and each of those cPanel accounts will have its own IP address.

  1. Generate the Certificate Signing Request (CSR) in WHM, using *.domain.com
  2. Read this article to learn how to assign each account its own IP address
  3. When you’re obtained the certificate,go to WHM > Install a SSL Certificate and Setup the Domain and paste in the CRT and CA Bundle for *.domain.com
  4. The fields should auto-populate, in which case you need to make sure the IP is correct, then change the SSL hostname from *.domain.com to the target subdomain
  5. Click install to install the certificate

One Account

This method may be best for users that are not resellers or that are on shared hosting servers, where having multiple cpanel accounts may not be ideal. In this case, you’d have one cPanel account and assign multiple IPs to its subdomains.

  1. Generate the Certificate Signing Request (CSR) in WHM, using *.domain.co
  2. Read this article to learn how to assign dedicated IPs to multiple subdomains on the same account
  3. When you’re obtained the certificate,go to WHM > Install a SSL Certificate and Setup the Domain and paste in the CRT and CA Bundle for *.domain.com
  4. The fields should auto-populate, in which case you need to make sure the IP is correct, then change the SSL hostname from *.domain.com to the target subdomain
  5. Click install to install the certificate

How to Enable Passive FTP

Posted by Vanessa | Posted in Misc | Posted on May 11, 2010

0

Passive FTP is not enabled with pure-ftp by default. To enable this, edit /etc/pure-ftpd.conf and uncomment out this line:

PassivePortRange          30000 50000

This means that FTP will answer passively on the range of ports between 30000 and 50000, so you may want to narrow the scope to something like 30000 to 35000.  Once you do this, you need to restart FTP and open the range of ports you selected in your server’s firewall.

If you’re running ProFTP, you can edit /etc/proftpd.conf and add this line, if it doesn’t already exist elsewhere:

PassivePorts 30000 50000