Archive for September, 2010

SBDavid

How can I setup secondary DNS server

How can I setup secondary DNS server.

1. You can use two of the IP’s assiged to your server.

2. You can setup an additional linux based server and install the free, “DNS Only” version of cPanel.

Latest Installer for DNSONLY servers.

http://layer1.cpanel.net/cpanel-dnsonly-install.sea

This script can also be downloaded as http://httpupdate.cpanel.net/latest-dnsonly

Quick way to add more SWAP space on your server

To check the swap space used you can use “free -m“.

If for some reason you have a server with too little SWAP then there is a quick way to create a swap file and then use it for additional swap space on the server.

dd if=/dev/zero of=/opt/swapfile bs=1024 count=2048000
mkswap /opt/swapfile
swapon /opt/swapfile
swapon -s

And then we need to add the following to the /etc/fstab.

/opt/swapfile swap swap defaults 0 0

How do I enable error logging for PHP scripts which helps in debugging application?

PHP errors are by default logged to the web server’s error log file (at least they are with the default setup on most Linux distros) but it is also possible to instead log PHP errors to a file of your choice. This is useful on production websites so you can periodically check for errors and fix them in a location other than the default webserver error log file.

If you do not currently have a php.ini, make one and place it in the same folder(s) as the PHP script(s) that you want to track errors for. You will need to add the following 2 lines:

log_errors = On
error_log = error_log

If we choose to enable error logging, then we MUST check the error_log often and take corrective actions for persistent errors, it’s recommend having it disabled for security reasons.

How do I import a Database using PhpMyAdmin in Cpanel

To import we will need the file in .sql format, not compressed .zip or .tar.gz file.

Log into your CPanel and find the link for PhpMyAdmin.

Once in PhpMyAdmin you will see on the left side a drop down of the databases, select the database you would like to import to.

This will create some tabs at the top of the screen, click on SQL.

After clicking on SQL you will see a Text Box area and a file upload option.

Click browse on the file upload option and find your .sql file

After you have selected the file click GO and it will import your database to the server.

Delivering mail to local mail server if your DNS is hosted on remote Cpanel VSP

Login to WHM and go to “DNS Functions” and select “Edit a DNS Zone”

Select the zone to edit and then select the “Edit” button.

Once the next screen appears scroll down to the “Record Type” MX and change the value to mail.serverbuddies.com.

serverbuddies.com. 14400 IN MX 0 mail.serverbuddies.com.

Change the “Record Type” to “A” for mail and add the IP address of your local mailserver in the box to the right of the “CNAME” record type.

mail 14400 IN A 192.168.1.1

Now DNS server will instruct mail servers on the internet to deliver mail to your local mail server.

Edit the file /etc/localdomains and remove the domain name for which you want email delivered locally.

Edit the file /etc/remotedomains and add the domain name which we removed from /etc/localdomains

Now local (cpanel) mail server (Exim) will route all email originating from the local server to the remote mail server.

« Prev - Next »