Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Web Hosting FAQ

Cpanel Newbie Guide

This guide assumes you already have Cpanel installed and we'll walk you some of the very basics of using your new Cpanel server. We expect you have some knowledge of what cpanel actually is and know a bit about server administration. This guide has been created by Steven Leggett and cannot be reproduced without my expicit permission. Please link to this page for the latest updates to this guide.
Lets get started!

Logins!
You need to login to your box right well here are a few things to help you. SSL logins are highly recommended for security - please see our Force SSL logins in the Cpanel Tutorials for more details.

  • WHM
    - Secure SSL https://sitename.com:2087
    Notice: Root user should only ever login using the secure HTTPS login!
    - Regular http://sitename.com:2086 and http://yourdomain.com/whm
  • Cpanel
    - Secure SSL https://sitename.com:2083
    - Regular http://sitename.com:2082 and http://yourdomain.com/cpanel
  • Webmail
    - Secure SSL https://domain.com:2096
    - Regular http://domain.com:2095 and http://yourdomain.com/webmail

Edit Setup
Now login to your WHM as the root user.
This is the main section to your web server where you can set the options once and will probably never need to change them.


Main Shared Virtual Host IP:
This is your servers main IP address to be used be default with all shared hosting accounts. This should be setup by default and you probably won't need to change this unless you want to use a different IP.

Server Contact E-Mail Address:
You will get email alerts sent to this address and make sure you have a decent size inbox for them, something over 2 megs because you will often receive updates, Log Files and all kinds of other goodies.

Server Contact Pager Address:
Another contact method for receiving special alerts if your server goes down. We recommend leaving this empty and using a third party monitoring service like SiteUptime.com or Alertra.com because if your server is already down, how will it contact you :)

Default cPanel Theme:
The theme you want to be used be default with all new hosting accounts. There are a few to choose from and if you install a custom theme you can enter the name of it here. To see what themes you have installed on the server, scroll down to the left hand size and look for the title: Themes, click on List Installed cPanel Themes.

Alternate Main Ethernet Device:
Don't touch this unless you've setup a custom ethernet configuration.

Default Home Directory:
We recommend setting this to: /home

Home Directory Prefix:
Leave this set to home

Hostname:
Many people get confused about what this is. Basically you make up the prefix in it and apply the main domain used to host your sites to it.
Example: If the main site for the server was test123.com I could set the hostname to server1.test123.com or mars.test123.com The prefix helps you identify which server this is. Make sure to set your hostname properly by using the Change Hostname link at the top left, this should match what you set there.


Apache Access Log Style:
Set this to: combined

Minimum Uid:
Leave blank

Primary Nameserver:
There are two options for these depending on what you're doing.
Option 1) Shared Nameservers - Easiest
This is where you would use your datacentre's default name servers such as ns1.ev1servers.net and ns2.ev1servers.net
No other configurations are required making this a snap. You would when set all your domain names nameservers, that you want to put on the server , to the same name servers that you entered here.


Option 2 Private Nameservers - Difficult
This can get very ugly if you don't know what you're doing. We recommend using shared nameservers but if you want your own then follow our Cpanel Nameserver Guide here.


First off is updates with Cpanel:
Login to WHM (Web Host Manager) and go to, Server Setup/Change Update Preferences:


Edge Release:
Right from a programmers hands, this is the first layer of Cpanel that is used for testing, patching etc. It has the latest fixes but isn't as well tested as other releases.

Current:
This is upgraded from the edge release so it has been tested a bit more.

Release:
Again another layer of testing, it is older code and has been run on more systems but it takes longer for updates to get to it.

Stable:
Very old but the most stable version around, it has been tested the longest.

We recommend you set to manual updates, Release option. I prefer manual over automatic because I like to keep a better eye on what has been changed.
If you select manual and you want to perform the update simply scroll down WHM and go to Cpanel > Upgrade To Latest Version.

This will update Exim, scripts, themes, Perl and Cpanel if updates are available - it will only update to the Cpanel release type you selected previously.

To see if new updates are available go to http://layer2.cpanel.net
You can also click on the Change Log at the top of WHM to see their latest updates and releases.

Cpanel and the kernel - use up2date
Cpanel can update your system software - but won't upgrade your kernel for you, you have to do that with up2date
Note: Don't upgrade Perl with up2date it will break your Cpanel Perl!

Up2date information can be found here:
http://forum.rackshack.net/showthre...ghlight=up2date
Note: You need to use rhn_register before up2date will work!
"You can use the RedHat Network for free by registering from your system (/usr/sbin/rhn_register) and running up2date from there. Then up2date -l will show the list of available updates"


Tweak Settings:

Things to enable:

  • Webalizer Stats
  • Awstats Stats (Very nice stats program - recommended.
  • Spamassassin
  • Disk Space Usage Warnings
  • The number of times users are allowed to check their mail using pop3 per hour: (60)
  • The maximum each domain can send out per hour (0 is unlimited): (250) - This is SMTP only!
  • Email users when they have reached 80% of their bandwidth


Things you don't or shouldn't really enable:

  • Prevent the user 'nobody' from sending out mail to remote addresses (php and cgi scripts generally run as nobody if you are not using phpsuexec and suexec respectively.)
    (This won't allow PHP scripts to send mail - EG formmail or anything else as they're sent using nobody)
  • Keep log files at the end of the month (default is off as you can run out of disk space quickly)
  • Do not enabled email user their lost password option


Backups
Configure Backup under WHM:

  • Backup Status: Enabled
  • Backup Interval (Note: Selecting Daily Backup with give you monthly and weekly as well, Selecting Weekly backup will give you monthly as well.) Daily or weekly - up to you
  • Days to run backup (explanitory)
  • Remount/Unmount backup drive (requires a seperate drive/coda/nfs mount) - Disabled
  • Bail out if the backup drive cannot be mounted (recommended if you have selected the above option) - Enabled
  • Incremental backup (only backup what has changed. (**No Compression**) - Disabled
  • Backup Accounts - Enabled
  • Backup Config Files (not needed to restore specific accounts) - Enabled
  • Sql Databases (at least per accounts is needed to use the restore feature) - Per account
  • Backup Raw Access Logs - Enabled
  • Backup Destination (this should be a dir/nfs/coda mount with at least twice the space of all your /home* partitions. Setting this to /home is a VERY BAD IDEA.): - /backup
    (Note: you need a second hard drive and should have it set to /backup in your fstab file)

Service Status
System Health and running services - eg Apache, Exim etc.
Green = Good | Yellow = Warning | Red = Trouble
Clients can see the service status through their own Cpanel as well.

Things to pay attention to:
- Server Load 0.12 (1 cpu) - the lower the better!
- Memory Used


Firewall
How to install APF (Advanced Policy Firewall)

Logs
Apache Logs Explained
No one tells you where they are but it's very important to know
*Important!
All users have their own seperate log files - every domain has their own logs - eg: sitename.com

  • Exim: - /var/log/exim_mainlog -/var/log/maillog -/var/log/exim_paniclog
  • Apache: -Error Log: /usr/local/apache/logs/error_log (404 not found errors, etc)
    - Access Log: /usr/local/apache/logs/access_log
    - Site Logs: /usr/local/apache/domlogs/sitename.com
  • Logins: /var/log/secure /var/log/logins_log
  • Messages: /var/log/messages
  • Cpanel: /usr/local/cpanel/logs/access_log

Fixing Log Rotation Problems

Since installing cpanel on some of our server, we noticed the logs in /usr/local/apache/logs/* growing out of control without ever being Rotated. In /etc/logrotate.d the script called "apache" is the reason why. Its totally wrong. Its looking for files located in /var/log/httpd/ and that is not where my log files are located. In fact, we dont even have files in this directory. Its completely empty.

The first line:

/var/log/httpd/access_log /var/log/httpd/agent_log
/var/log/httpd/error_log /var/log/httpd/referer_log {

should be changed to, at the very minimum;

/usr/local/apache/logs/access_log
/usr/local/apache/logs/agent_log /usr/local/apache/logs/error_log
/usr/local/apache/logs/referer_log {

In addition, you may want to add the follow logs to the list above
and any other files you find that needs to be rotated in this directory.

ssl_engine_log
suexec_log

You could leave out agent_log and referer_log since i dont see those as even existing in my /logs/* directory but if you have them add them.

UDDATE: 08-23-03 - Thanks dkair!!!!
httpd.pid is not located in /var/run/. On my server its located in /usr/local/apache/logs. Also in "apache" change the following line;

/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true

to

/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true

End Change

Editing logrotate.conf

In /etc/logrotate.conf where is the reference to lastlog? The default apache log includes a rotatation of lastlog but i didnt find an entry in my logrotate.conf.

My /var/log/lastlog was around 19megs so add the following to logrotate.conf so the added entry looks like this.

# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}


# system-specific logs may be configured here


/var/log/srv08.primenet.cc { weekly
rotate 1
}

/usr/local/cpanel/logs/access_log {
weekly
rotate 1

}

/usr/local/cpanel/logs/stats_log {
weekly
rotate 1

}

SSL logs:

If your running ssl on your server you will find some huge log files in /var/log if you have never rotated them. Ours was hitting 51megs. Your SSL log files will match the name of your hostname or the name of your certificate or both depending on how many SSL certs you have running. You could also add those above.

Also, do you really need to keep 4 sets of rotated logs? I rarely refer back that far unless i have some problem and i need to go back to view the logs but usually going back 1 or 2 weeks of rotated logs is sufficient. I have changed my number of backup logs in logrotate.conf to 2. Old rotated logs even going back 4 weeks could take up huge amounts of disk space if there was alot of activity. Consider compressing the rotated logs. Simply uncomment #compress which will compress your old rorated logs.

Now whats happening to xferlog? It was being rotated at one stage but no longer. The last time it was rotated was back in Nov 22 of 2002 on my box. Since then the file has grown to 25megs and not rotated. So was it lost somewhere in all the cpanel updates? One will never know since i cannot find any reference anywhere to it being rotated. If this is also the case on your box do this. If anyone knows where its being rotated let me know because i cannot find it

cd /etc/logrotate.d

is there proftpd in that directory?

FIX;

in the logrotate directory create proftpd

pico or vi proftpd

add;

/var/log/xferlog {
postrotate
/bin/kill -HUP `cat /var/proftpd.pid 2> /dev/null` 2> /dev/null || true
endscript
missingok
}

End Change

Save it.

Thanks to Aussie for his contribution.



Other things to know:
Restart Cpanel in SSH #:
/etc/rc.d/init.d/cpanel restart

Cpanel Manual Backup & Update - if backup doesn't work through WHM - SSH command #:
cd /scripts/ then do ./cpbackup
cd /scripts then do ./upcp


Apache Config Test in SSH: -test httpd.conf file for errors!
/usr/local/apache/bin/apachectl configtest

The configuration file is located in /usr/local/apache/conf/httpd.conf so you may need to edit it in Pico or your favourite editor and make changes.

Manual Stop - Start of services in SSH: (start | stop | restart) #
service httpd
service exim
service proftpd
service named
service mysql


That's all I can think of for now! Overall Cpanel is easy to use and has some nice automated features but a control panel can only do so much, you need to get your hands dirty sometimes!
Read More Here



This post first appeared on TopHost : Web Hosting Providers,domain Name Regist, please read the originial post: here

Share the post

Web Hosting FAQ

×

Subscribe to Tophost : Web Hosting Providers,domain Name Regist

Get updates delivered right to your inbox!

Thank you for your subscription

×