Featured Posts

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...

Read more

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...

Read more

Simple Bash Script to Fix Account Permissions This is a simple bash script I wrote to fix the permissions and ownership of files within a cpanel account. To use, simply copy the script your server, chmod 755, and pass the usernames as arguments: ./fixperms...

Read more

Re-Installing Auxiliary cPanel Software Cpanel has a lot of supporting software that you may be using on your server. In case something goes amiss, here is a list of scripts that reinstall cpanel-provided software on your system. For most all...

Read more

10 Free Monitoring Solutions to Consider Server and network monitoring can be crucial to a host's success. I mean, how embarrassing is it when your customers are aware of downtime before you are? You don't have to pay big bucks or spend loads...

Read more

The cPanel Admin Rss

Setting Up Wildcard DNS with cPanel

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

0

Wildcard DNS allows a server to display and combination of subdomains for a website. For example, wildcard DNS for thecpaneladmin.com will allow any subdomain to resolve to this website, even if they have not been specifically created.  Subdomains that have been created individually in cPanel will still route to their respective folders, but anything else will go to the document root of the domain the subdomains are based on. Wildcard DNS is most used for implementation of applications like WordPress MU. To set up wildcard DNS:

In the DNS zone for the parent domain, simply create an A  or CNAME record for *. For example, either of these will work:

*   IN   A   5.5.5.5

*   IN CNAME mywebsite.com.

Now on the server, edit /var/cpanel/userdata/$user/$parentdomain, and look for the serveralias line. This is where the parked domains/aliases for a domain are listed, so you just need to append *.parentdomain to the same line. A serveraliase line for thecpaneladmin.com may look like this:

serveralias: www.thecpaneladmin.com thecpaneladmin.net www.thecpaneladmin.net *.thecpaneladmin.com

Now run:

/scripts/rebuildhttpdconf

And restart Apache. You can test the Wildcard subdomains by going to any subdomain of the parent domain, and it should go to the parent domain’s site. This may not be what you wanted it to do though. With wildcard DNS and virtualhosts, you need an .htaccess rewrite to redirect the subdomains. For example:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
RewriteRule (.*) %2/$1 [L]
</IfModule>

In the above example, if your subdomain is test.domain.com, the rewrite will send you to http://domain.com/test/page.html. You can modify the rewrite accordingly to achieve the results you want.

Keep in mind that the Apache configuration has to be done by someone with access to the user’s Apache config files, as you can’t add *.domain.com to cPanel as a subdomain or parked domain at this time. cPanel may change this in the future, but for now it’s something that the end user cannot do without administrator access.

Resolving Domain Park Wrapper Errors

Posted by Vanessa | Posted in Misc | Posted on January 24, 2010

2

If you run a more populated shared hosting server, sooner or later you’ll have received complaints about the dreaded park wrapper errors in cPanel that occur when a user tries to add a parked or addon domain to their cPanel. The errors may look like this:

Error from domain wrapper: domain.com is owned by another user.

Error from domain wrapper: Domain already exists, it was not added.

I’ve never really been able to attribute that error to a specific action, but my assumption is that it occurs as a result of the end user not completely removing the domain from their cPanel (i.e. hitting esc or closing the browser during removal), therefore not allowing cPanel to remove the domain’s entries to allow that domain to be re-added when certain security settings are enabled in WHM > Tweak Settings.

The easy solution to the first error is to enable the option for users to add domains owned by other users via WHM > Tweak Settings. But this is a very bad idea as it essentially allows users to repoint domains that you’re already hosting.

If you’re attempting to re-add a domain to a cPanel account and are getting one of the above errors, first check that the error needs to be corrected. Meaning, make sure that the domain in question isn’t already set up elsewhere. If it is, you would need to remove it from that account before being able to add it to another.

If the error is actually occurring due to an improperly removed domain, follow the below steps until you are able to add the domain back to the server:

  1. run /scripts/killdns <domain> on the server to remove the DNS records from the DNS cluster
  2. do grep -r <domain> /var/cpanel/users to see if it exists in a user file, and if so, delete the entry and run /scripts/updateuserdomains, make sure it’s remove from /etc/userdomains
  3. grep -r <domain> /var/cpanel/userdata to see if the domain appears in a user’s template. If so, remove any files based on the domain name (including .cache files), and remove any subdomain/parked/addon domain entries for that domain from the ‘main’ file located in that user’s folder (i.e. /var/cpanel/templates/username/main), then /scripts/rebuildhttpconf to remove it from httpd.conf .

This should allow you to re-add the domain name to the user’s cPanel without getting the park wrapper error.

cPanel Command Line DNS and Cluster Management

Posted by Vanessa | Posted in Misc | Posted on January 20, 2010

3

DNS clustering is part of setting up a server environment. cPanel has built-in support for DNS clustering to make it easy to deploy centralized nameservers, or have multiple nameservers receive DNS zone updates from one server. This article will help you understand setting up and managing a DNS cluster from command line.

Setting up a Cluster

From the remote nameserver:

You generally don’t need to do anything other than enable clustering in WHM. You want the client servers to sync TO this server, not from it. Most of the time, the remote server will be your primary nameserver running cPanel DNSONLY.