cPanel is a popular control panel that simplifies website and server management. It provides a user-friendly interface to handle tasks like creating email accounts, managing files, and setting up databases without needing to use complex command-line tools. Think of it as a dashboard for your web hosting.
IMPORTANT CPANEL DIRECTORIES
cPanel relies on specific directories to store its files, configurations, and scripts. Knowing these can help understand how cPanel works behind the scenes.
/usr/local/cpanel: This is the main directory for cPanel's core files, including its main services, binaries, logs, and user interface elements.
/var/cpanel: This directory holds important configuration data for cPanel, user settings, reseller information, logs, and bandwidth data.
/scripts: This directory contains many scripts that perform various cPanel and WHM (Web Host Manager) functions, like updates, backups, and account management.
DEEPER DIVE INTO /USR/LOCAL/CPANEL
This directory is the heart of your cPanel installation.
Core Services: You'll find executables like cpsrvd
(the main cPanel process), cpsrvd-ssl
(for secure connections), and cpkeyclt
(for license management).
Binaries and Scripts (/usr/local/cpanel/bin
): This sub-directory contains scripts for installing and configuring cPanel services, such as eximstats
(for email statistics) and checkperlmodules
(for checking Perl modules).
Logs (/usr/local/cpanel/logs
): Important activity logs are stored here, including access_log
and error_log
for cpsrvd
, stats_log
for cpanellogd
, and license_log
for license updates.
User Interface Files (/usr/local/cpanel/base
): This is where the different cPanel and Webmail themes (like x
, x2
, monsoon
) and third-party applications (like squirrelmail
, phpMyAdmin
) are located.
Configuration Templates (/usr/local/cpanel/etc
): This directory holds templates for various services like Exim (mail server), FTP, Apache (web server), and DNS zones.
Third-Party Tools (/usr/local/cpanel/3rdparty
): This contains various third-party binaries and configuration files used by cPanel, such as PHP, stunnel, and website analytics tools like Analog and Webalizer.
DEEPER DIVE INTO /VAR/CPANEL
This directory stores crucial configuration and data files.
Primary cPanel Configuration (cpanel.conf
): This file defines how cPanel behaves, with each setting on a new line. If it's missing, cPanel uses default values.
Reseller Information (resellers
): This file lists all resellers and the WHM resources they can access.
Accounting Logs (accounting.log
): Records actions like account creation and removal performed through WHM.
Bandwidth Data (bandwidth
): Contains files tracking bandwidth usage for each account, named after the user.
Feature Lists (features
): These files determine which cPanel resources are available to users, based on their assigned feature list name.
Packages (packages
): Defines different hosting packages. If a package belongs to a reseller, its file name will start with the reseller's name.
User Configurations (users
): These files store individual cPanel user settings, including their account resources, themes, and domains.
Other Notable Subdirectories:
LOGS
: Stores logs from account copies and transfers.
UPDATELOGS
: Contains logs from every cPanel update.
MAINIPS
: Stores the main shared IP address for each reseller.
ZONETEMPLATES
: Holds customized DNS zone templates created in WHM.
THE /SCRIPTS DIRECTORY
This directory is a powerhouse of utility scripts. These scripts are "building blocks" for many cPanel/WHM features and can be used to:
Update cPanel and its managed services.
Automate account creation.
Perform backups of cPanel accounts.
Install and update cPanel-managed services.
KEY CPANEL SERVICES
Several services work together to make cPanel function.
CPSRVD: The "master" process for cPanel. It handles all requests from the cPanel, WHM, and Webmail interfaces, logging its activity to access_log
and error_log
. It communicates securely using stunnel
for SSL connections.
CHKSERVD: A service monitoring tool that checks the status of various services (like CPU, memory, and disk usage) every eight minutes. It logs to /var/log/chkservd.log
and can dispatch alerts.
CPANELLOGD: Responsible for processing bandwidth logs and running statistics generators for each account. It's configured through WHM and stores statistics in /home/{username}/tmp
.
CPBACKUP: Handles cPanel backups, typically configured to run daily at 1:00 AM via a cron job. Backups can be standard, incremental (using rsync), or remote (to an FTP server).
EXIMSTATS: This daemon collects bandwidth information from Exim (mail server) transactions, storing it in the eximstats
database. It monitors exim_mainlog
for data.
CPANEL STARTUP AND LICENSING
Startup: Services like cpsrvd
, cPanel POP, and Log Services are controlled by the cPanel init script. You can check if ports are in use using netstat -lnp | egrep '20(8|9)'
.
SSL Certificates: Default certificates are in /usr/local/cpanel/etc/cpanel.pem
. User-installed certificates are in /usr/local/cpanel/etc/mycpanel.pem
.
Troubleshooting Startup (SSL): If SSL services aren't available, try /usr/local/cpanel/startstunnel
and check /usr/local/cpanel/3rdparty/bin/stunnel.log
. For cpsrvd
issues, run it directly and check its error log.
Licensing: License requests are handled by /usr/local/cpanel/cpkeyclt
and sent to auth.cpanel.net
over port 2089. The license key is stored in /usr/local/cpanel/cpanel.lisc
.
Troubleshooting License Issues: Verify your license at http://verify.cpanel.net
, check server connectivity to auth.cpanel.net
on port 2089, and review license_log
for errors.
CPANEL AND WHM REQUESTS
cPanel Requests: Logins use system password files. The document root for cPanel is /usr/local/cpanel/base
. User themes and resources are defined in their configuration files and feature lists.
WHM Requests: The root password authenticates reseller users. The document root for WHM is /usr/local/cpanel/whostmgr/docroot/
. Reseller resources are controlled by Access Control Lists, stored in /var/cpanel/resellers
.
CPANEL MAINTENANCE AND UPDATES
cPanel automatically applies nightly updates at 2:13 AM using the /scripts/upcp
script.
Update Process:
/scripts/updatenow
: Synchronizes the /scripts
directory.
/scripts/sysup
: Updates cPanel-managed RPMs.
/scripts/rpmup
: Updates other system packages using your distribution's package manager (e.g., yum for CentOS).
Logging: Updates are logged to timestamped files in /var/cpanel/updatelogs
.
Configuration (/etc/cpupdate.conf
): This file controls update behavior, including the cPanel update branch (e.g., stable
, release
, current
, edge
) and whether system and RPM updates are applied.
Manual Updates: You can force a cPanel update by executing /scripts/upcp
or /scripts/upcp --force
if components are missing.
cpanelsync
: This script, called by updatenow
and upcp
, uses MD5 checksums to synchronize files with cPanel update servers.
USEFUL CPANEL SCRIPTS
The /scripts
directory contains many command-line utilities for managing your server.