cpanel Structure Details for the structure of cpanel & WHM by Kevin Asklund. The cpanel and WebHost Manager package includes: * cpanel - Domain Owner Control (:2082 & :2083) * WebHost Manager - Server Administration and Reseller (:2086 & :2087) * Webmail Panel - Webmail Access (:2095 & :2096) Directory Structure of cpanel === Apache == /usr/local/apache bin- apache binaries are stored here - httpd, apachectl, apxs conf - configuration files - httpd.conf - php.conf cgi-bin domlogs - domain access and stat log files are stored here for all domains htdocs - default apache DocumentRoot location include - header files libexec - shared object (.so) files are stored here - libphp4.so,mod_rewrite.so logs - apache logs - access_log, error_log, suexec_log man - apache manual pages icons - icon/jpg/gif images modules - shared object (.so) files are store here - Apache-2.x+ Init Script :/etc/rc.d/init.d/httpd or /usr/local/apache/bin/apachectl - apache start script Cpanel script to restart apache - /scripts/restartsrv_httpd /opt - Apache modules built here Exim Conf : /etc/exim.conf - exim main configuration file - Do not manually edit /etc/localdomains - list of domains allowed to relay/receive mail Log : /var/log/exim_mainlog - incoming/outgoing mails are logged here Log : /var/log/exim_rejectlog - exim rejected mails are reported here Log : /var/log/exim_paniclog - exim errors are logged here Mail queue: /var/spool/exim/input Cpanel script to restart exim - /scripts/restartsrv_exim Email forwarders and catchall address file - /etc/valiases/domainname.com Email filters file - /etc/vfilters/domainname.com POP user authentication file - /home/username/etc/domainname/passwd Catchall inbox - /home/username/mail/new POP user inbox - /home/username/mail/domainname/popusername/new POP user spambox - /home/username/mail/domainname/popusername/spam
Program : /usr/sbin/exim (suid - -rwsr-xr-x 1 root root ) Init Script: /etc/rc.d/init.d/exim : /scripts/restartsrv_exim : service exim restart ProFTPD === Program :/usr/sbin/proftpd Init Script :/etc/rc.d/init.d/proftpd : /scripts/restartsrv_ftpserver Conf: /etc/proftpd.conf Log: /var/log/messages, /var/log/xferlog Accounts file - /etc/proftpd/$username - all ftp accounts are stored here Pure-FTPD ==== Program : /usr/sbin/pure-ftpd Init Script :/etc/rc.d/init.d/pure-ftpd : /scripts/restartsrv_ftpserver Conf: /etc/pure-ftpd.conf Accounts file: /etc/proftpd/$username - all ftp accounts are stored here Anonymous ftp document root - /etc/pure-ftpd/ip-address Frontpage Extensions == Program - (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe Uninstall and then install for re-installations FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html /scripts/setupfp5 domain.com Mysql == Program : /usr/sbin/mysqld :/usr/bin/mysqld_safe Init Script : /etc/rc.d/init.d/mysql : service mysql start/stop : /scripts/restartsrv_mysql Conf : /etc/my.cnf, /root/.my.cnf Data directory - /var/lib/mysql - Where all databases are stored. Database naming convention - username_dbname (eg: john_sales)(dbmapping) Log: Startup errors - /var/lib/mysql/hostname.tld.err Socket file - /var/lib/mysql/mysql.sock, /tmp/mysql.sock PostgreSQL ==== Program: Init Script: Conf: /var/lib/pgsql/data/postgresql.conf & pg_hba.conf Data Directory: /var/lib/pgsql/data Log: /var/lib/pgsql/
SSHD = Program :/usr/local/sbin/sshd Init Script :/etc/rc.d/init.d/sshd - /scripts/restartsrv_sshd - service sshd restart Conf: /etc/ssh/sshd_config Log: /var/log/messages Perl ==== Program :/usr/bin/perl or /usr/local/bin/perl (one should symlink to the other) Directory :/usr/lib/perl5/5.8.x/ or /usr/local/lib/perl5 Version: perl -v Check: /scripts/checkperlmodules : /scripts/perlmods -s Installer: /scripts/perlinstaller : perl -MCPAN -e shell Build: /home/.cpan :/home/.cpcpan PHP ==== System PHP Program :/usr/local/bin/php, /usr/bin/php, /usr/local/php4/bin/php ini file: /usr/local/lib/php.ini - apache must be restarted after any change to this file php can be recomplied using /scripts/easyapache : /scripts/phpup using /var/cpanel/ easy/apache/profile/ Internal PHP Program : /usr/local/cpanel/3rdparty/bin/php : /var/cpanel/3rdparty/bin/php ini file: /usr/local/cpanel/3rdparty/etc/php.ini internal PHP can be recompiled using : /scripts/makecpphp using /var/cpanel/easy/ apache/profile/makecpphp.profile.yaml /var/cpanel/3rdparty Named(BIND) == Program: /usr/sbin/named Init Script: /etc/rc.d/init.d/named Config: /etc/named.conf Zone files:/var/named/ Log: /var/log/messages: /var/named/data/named.run NSD (Alternate DNS option)(limited to 500 domains and 50 IPʼs) = Program: /usr/sbin/nsd Init Script : /etc/rc.d/init.d/nsd
db records : /var/named Config: /etc/nsd/nsd.conf Log: /var/log/messages Courier Program: /usr/lib/courier-imap/libexec/couriertcpd Init Script: /etc/init.d/courier : /scripts/restartsrv_courier Config: /usr/local/libexec/courier-imap Log: /var/log/maillog Dovecot = Program: /usr/sbin/dovecot Init Script: /etc/init. Config: /etc/dovecot.conf Log: /var/log/maillog DBMapping ==== Directory: /var/cpanel/databases Scripts: /usr/local/cpanel/bin/dbindex /usr/local/cpanel/bin/dbmaptool /usr/local/cpanel/bin/dbstoregrants /usr/local/cpanel/bin/setupdbmap Tomcat Directory: /usr/local/jakarta/tomcat Conf: /usr/local/jakarta/tomcat/conf/server.xml Log: /usr/local/jakarta/tomcat/logs/catalina.out & catalina.err /usr/local/apache/logs/mod_jk.log Scripts: /scripts/addservlets --domain= & /scripts/remservlets Ruby ==== Directory: /home/username/rails_apps /home/username/.gem/ruby
Scripts: /scripts/installruby Spamd Directory: /etc/mail/spamassassin Program: /usr/bin/spamd & /usr/bin/spamc & /usr/bin/spamassassin Scripts: /scripts/installspam Clamd Conf: /etc/clamd.conf Scripts: clamscan freshclam EasyApache ==== /var/cpanel/easy/apache /var/cpanel/userdata /usr/local/apache/conf/ /var/cpanel/templates/apache2 /usr/local/cpanel/src/templates/apache2 /home/cpeasyapache /opt /usr/local/cpanel/logs/easy/apache cpanel installation directory structure ==== /usr/local/cpanel + 3rdparty/ - tools like fantastico, mailman files are located here + addons/ - AdvancedGuestBook, phpbb etc + base/ - phpmyadmin, squirrelmail, skins, webmail etc + bin/ - cpanel binaries + cgi-sys/ - cgi files like cgiemail, formmail.cgi, formmail.pl etc + logs/ - cpanel access_log, error_log, license_log, stats_log + whostmgr/ - whm related files + base/frontend - cpanel related files - themes
+ perl/ - internal Perl modules for compiled binaries + etc/init - init files for cpanel services WHM related files /var/cpanel - whm files + bandwidth/ - rrd files of domains + username.accts - reseller accounts are listed in this files + packages - hosting packages are listed here + root.accts - root owned domains are listed here + suspended - suspended accounts are listed here + users/ - cpanel user file - theme, bwlimit, addon, parked, sub-domains all are listed in this files + zonetemplates/ - dns zone template files are taken from here Common CPanel scripts ==== cpanel/whm Scripts are located in /scripts/ + addns - add a dns zone + addfpmail2 -Add frontpage mail extensions to all domains without them + addpop - add a pop account + addservlets - Add JSP support to a domain (requires tomcat) + adduser - Add a user to the system + apachelimits - calculates memory limits for apache processes then adds to httpd.conf + biglogcheck - looks for logs nearing 2 gigabytes in size + bsdcryptoinstall - Installs crypto on FreeBSD + bsdldconfig - Configures the proper lib directories in FreeBSD + bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages + buildbsdexpect - Install expect on FreeBSD + buildeximconf - Rebuilds exim.conf + buildpostgrebsd-dev - Installs postgresql on FreeBSD. + chcpass - change cpanel passwords (does not change all passwords) + cleandns - removes domains from named.conf that do not have a Zone. + courierup - used to update/reinstall courier + cpbackup - to backup accounts (if backups enabled) (--force) + dnscluster - used to synchronize DNS zones with clustered servers (--help) + dumpstor - displays contents of.datastore storable files + dumpgdbm - displays contents of.gdbm locale files + easyapache - recompile/upgrade apache and/or php + editquota - used to manually set a users quota limit + ensure_vhost_includes - ensures users includes are added in httpd.conf + eximup - used to update exim to latest version - will overwrite any manual changes + fixcommonproblems - fixes mailbox permissions, mailman, cgi scripts, ndc and quotas + fixfrontpageperm - fixes permission issues with Front Page + fixmailman - fixes common mailman issues + fixndc - fixes rndc errors with named
+ fixquotas - fixes quota problems + fullhordereset - resets horde database to a fresh one - all previous user data are lost + ftpup - used to update/install FTP server (pureftpd or proftpd) to latest version + generatemaildirsize - generates new maildirsize for any or all users *(--help) + initquotas - initializes quotas + installzendopt - installs zend optimizer - thru phpextensionmgr + killacct - terminate an account - make sure you take a backup of the account first + killdns - removes a DNS Zone + mailperm - fixes permission problems with mail directories + makecpphp - rebuilds internal PHP from /var/cpanel/easy/apache/profile/ makecpphp.profile.yaml + mysqlup - used to update mysql to latest version specified in /var/cpanel/cpanel.config + park - to park a domain - (only adds DNS) + pkgacct - used to create an account backup + pre* - used to create pre service scripts that run before a service is updated + post* - used to create post service scripts that run after a service is updated + phpup - used to update PHP only + phpextensiomgr - Installs IonCube, Zend Optimizer, SuHosin & eaccelerator + rebuildcpusers - chowns /var/cpanel/users files + rebuildnamedconf - rebuilds /etc/named.conf with zones from /var/named/*.db + rebuildparkeddomains + restartsrv_$servicename - restart script for services + restorepkg - restores an account from a backup file (pkgacct file)(must be in /home) + runlogsnow - update logs of all users + runweblogs - update stats for a particular user + securetmp - secures /tmp partition with options nosuexec and nosuid + setupftpserver - sets which FTP server to install (pureftpd or proftpd) + setupmailserver - sets which mail service to install (courier or dovecot) + setupnameserver - sets which DNS service to install (Bind or NSD) + suspendacct - suspends an account + unsuspendacct - unsuspends a suspended account + upcp - updates cpanel to the latest version (--force) + updatenow - updates the cpanel scripts + updateuserdomains - updates /etc/userdomains entries from /var/cpanel/users + wwwacct - to create new accounts (wwwacct domain.com user password) Important cpanel/whm files (& Config files) /usr/local/apache/conf/httpd.conf - apache configuration file /etc/exim.conf - mail server configuration file /etc/named.conf - name server (named) configuration file /etc/proftpd.conf - proftpd server configuration file /etc/pure-ftpd.conf - pure-ftpd server configuration file /etc/valiases/domainname - catchall and forwarders are set here /etc/vfilters/domainname - email filters are set here
/etc/userdomains - all domains are listed here - addons, parked,subdomains along with their usernames /etc/localdomains - exim related file - all domains should be listed here to be able to send/receive emails /etc/cpbackup-userskip.conf - /etc/sysconfig/network - Networking Setup* /etc/hosts - /etc/resolv.conf - Networking Setup > Resolver Configuration /etc/nameserverips - Networking Setup > Nameserver IPs ( FOr resellers to give their nameservers ) /var/cpanel/resellers - For addpkg, etc permissions for resellers. /etc/chkserv.d - Main >> Service Configuration >> Service Manager * /etc/ipaddrpool - ip addresses which are free /etc/ips.dnsmaster - nameserver ips /etc/domainips - IPʼs set as dedicated for specific domains /etc/wwwacct.conf - account creation defaults file in WHM (Basic cpanel/whm Setup)* /etc/cpupdate.conf - Update Config * /etc/cpbackup.conf - Configure Backup* /etc/clamav.conf - clamav (antivirus configuration file ) /etc/my.cnf - mysql configuration file /usr/local/lib/php.ini - php configuration file /etc/ips - ip addresses on the server (except the shared ip) (IP Functions >Show IP Address Usage )* /var/run/chkservd - Main >> Server Status >> Service Status * /var/log/dcpumon - top log process /root/cpanel3-skel - skeleton directory. Eg: public_ftp, public_html. (Account Functions) /var/spool/exim/input - Mail queue /var/spool/exim/msglog - email message logs /var/spool/cron - cronjobs are stored here for all users /var/cpanel/users - cpanel user file that defines account settings /var/cpanel/users.cache - user cache files that are read by cpanel /var/cpanel/cpanel.config - cpanel configuration file ( Tweak Settings )* /var/cpanel/counters - To get the counter of each users. /var/cpanel/bandwidth - To get bandwith usage of domains /var/cpanel/userdata - Defines parked, addon, subdomains as well as VirtualHost /var/cpanel/logs - transfer logs /var/cpanel/easy/apache - easyapache build files/profile /var/cpanel/userhomes - session home for cpanel, Horde, Roundcube, phpmyadmin /var/cpanel/serviceauth - chkservd service user/pass data /var/cpanel/updatelogs - upcp daily logs /var/cpanel/horde - version file, backups and logs stored here /var/cpanel/roundcube - version file, backups and logs stored here /var/cpanel/squirrelmail - version file stored here /var/cpanel/packages - default and custom packages created here /var/cpanel/databases - dbmapping files /var/cpanel/cpanelsync - DNS Clustering files
cpanel Ports needed: Port Service Protocol Direction 20 ftp tcp inbound/outbound 21 ftp tcp,udp inbound/outbound 22 ssh tcp inbound 25 smtp tcp inbound/outbound 26 smtp tcp inbound/outbound 37 rdate tcp outbound 43 whois tcp outbound 53 DNS tcp/udp inbound/outbound (inbound is only needed if you run your own public DNS server you) 80 http tcp inbound/outbound 110 pop3 tcp inbound 113 ident tcp outbound 143 imap4 tcp inbound 443 https tcp inbound/outbound 465 smtp tls/ssl tcp/udp inbound/outbound 873 rsync tcp/udp outbound 993 imap4 ssl tcp inbound 953 DNS/RNDC 995 pop3 ssl tcp inbound 2082 cpanel tcp inbound 2083 cpanel ssl tcp inbound 2086 whm tcp inbound 2087 whm ssl tcp inbound 2089 cpanel licence tcp outbound 2095 Webmail tcp inbound 2096 Webmail SSL tcp inbound 3306 mysql tcp (only if you need to connect remotely) 6666 chat tcp inbound also please note "Can I run cpanel behind NAT?" ( http://faq.cpanel.net/show.cgi?qa=110193189303894 )