Dedicated Server Support

Tips on Linux, FreeBSD, Windows Dedicated Server.

Monday, September 26, 2005

Moving BIG sites in Cpanel

Moving sites between Cpanel servers are easy with the WHM Transfer feature.

But some BIG sites fails/time out when moving with WHM Transfer feature. To move such sites, you have do backup and move it to new server and restore. Cpanel provides some tools do make the site backup and restore easy.

Here is how to move a site from SERVER1 to SERVER2.

On SERVER 1 (source)

1. Create Backup

Take backup of the web site with pkgacct

/scripts/pkgacct USERNAME

USERNAME - is the Cpanel login name of the site you want to move.

This will create backup file in /home folder.

/home/cpmove-USERNAME.tar.gz


root@godislove [~]# /scripts/pkgacct keralapa
pkgacct started.
pkgacct version 2.9 - running with uid 0
Copying Reseller Config...Done
Copying SSL Certificates, CSRS, and Keys...Done
Copying Mail files....Done
Copying frontpage files....Done
Copying proftpd file....Done
Copying www logs.............
.........
.........
.........
.........
Copying shell.......Done
pkgacctfile is: /home/cpmove-keralapa.tar.gz
Creating Archive .............
.........
Done
md5sum is: 4e77ff26c08094c5df1af9a1e4b88f37



2. Move the Backup to New Server

This can be done several ways, FTP, SCP, RSYNC, etc...

We use another way here, that is we just move the backup to public_html folder of a web site, then download it from SERVER2 with wget command

mv /home/cpmove-USERNAME.tar.gz /home/USERNAME_OF_ANY_SITE/public_html/

Now make the file accessable by public

chmod 777 /home/USERNAME_OF_ANY_SITE/public_html/cpmove-USERNAME.tar.gz


ON SERVER 2 (destination server)

1. Downloading the Backup

cd /home
whet http://websiteonserver1/cpmove-USERNAME.tar.gz


2. Restore the Account

/scripts/restorepkg USERNAME

Now you can edit DNS on SERVER1 and point it to SERVER2.

Then change name servers, wait 24 Hours to propogate, verify it is pointing directly to new server, then you can delete the site from old server safely.

Friday, September 23, 2005

Cpanel acount creation error

Today one client told he is getting error when creating new accounts on his Cpanel Server. I tryed to create a test account.

WWAcct 10.0 (c) 1997-2005 cPanel, Inc.

+===================================+
New Account Info
+===================================+
Domain: hsdhj.com
Ip: 72.36.202.250 (n)
HasCgi: y
UserName: hsdhjco
PassWord: jjjkjkjkjkjkjk
CpanelMod: x
HomeRoot: /home
Quota: unlimited Meg
NameServer1: ns1.bizhat.com
NameServer2: ns2.bizhat.com

NameServer3:
NameServer4:
Contact Email:
+===================================+
Changing password for hsdhjco
Password for hsdhjco has been changed
Keeping Shell Access (y)
Jail Shell Enabled
Changing shell for hsdhjco.
Shell changed.
Copying skel files from /root/cpanel3-skel/ to /home/hsdhjco/
Using Quota v3 Support
[an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive][an error occurred while processing this directive]

Added Entries to httpd.conf
Bind reconfiguring on server1 using rndc
Added Named File
No Server found



Restarting apache
Ftp Password Files synced
Notifcation => clientsemail@hotmail.com via EMAIL [level => 3]
Vhost Passwords synced
wwwacct creation finished

Account Creation Complete!!!



So i have checked Cpanel configuration at

cd /var/cpanel
more cpanel.config


Everything seems ok, now Cpanel error log at


cat /usr/local/cpanel/logs/error_log


cPScript::Template::gethttptemplate('default', 'apache1', 'HASH(0x89814d0)') called at /scripts/wwwacct line 1012
(internal warning) Fri Sep 23 03:11:14 2005 [13558] warn: Unused key: servername passed! at /scripts/cPScript/Template.pm line 89.
at /scripts/cPScript/Template.pm line 89
cPScript::Template::gethttptemplate('default', 'apache1', 'HASH(0x89814d0)') called at /scripts/wwwacct line 1012
(internal warning) Fri Sep 23 03:11:14 2005 [13558] warn: Unused key: settings-phpopendir passed! at /scripts/cPScript/Template.pm line 89.
at /scripts/cPScript/Template.pm line 89
cPScript::Template::gethttptemplate('default', 'apache1', 'HASH(0x89814d0)') called at /scripts/wwwacct line 1012
(internal warning) Fri Sep 23 03:11:14 2005 [13558] warn: Unused key: serveradmin passed! at /scripts/cPScript/Template.pm line 89.
at /scripts/cPScript/Template.pm line 89
cPScript::Template::gethttptemplate('default', 'apache1', 'HASH(0x89814d0)') called at /scripts/wwwacct line 1012


It seems some thing missing apache template. So just upgraded Cpanel with force option.

/scripts/upcp --force

After control panel upgradation WHM account creation is working fine.

Thursday, September 22, 2005

Hosting Site with Dedicated IP on Windows 2003 HELM

Today one client hosted on Windows 2003 server (HELM Control Panel) need SSL.

To install SSL, a site need Dedicated IP Address.

HELM do not support Hosting of sites with dedicated IP, in HELM all sites get added to servers shared IP. So i have to do this manually.

I have loged in to server through Remote Desktop Connection as Administrator. Then run Internet Information Service Manager.

Start > Run > inetmgr

Then click on Server Name, then Web Sites, This will list all websites hosted on the server under IIS.

Now click on the domain you want to change to dedicated IP Address.

In this case, i want to host the site car-toonies.co.uk on dedicated IP: 67.19.193.94

After taking property of the web site, you will be on "Web Site" tab.

Select the new dedicated IP address in

Web Site Identification > IP Address

I selected 67.19.193.94 from the drop down box. This IP should be already added to your Network card (TCP/IP settings), then only IP will be listed here.

Now we want to remove Host Headers, this is important step. By default IIS will resolve sites using Host Headers (for Name based Hosting).

To do this, click on "Advanced" button just right side of the "IP Address" drop down list. You will see

IP Address - Port - Host Header

There will be two entries, one for

car-toonies.co.uk

and another for

www.car-toonies.co.uk

Now just remove the entry for www.car-toonies.co.uk

Now the remining is car-toonies.co.uk

Edit it and remove the value of host header, leave it blank and save.


After doing this, i checked the site

http://www.car-toonies.co.uk

It is not working, but when i go to IP address, i can see the site

http://67.19.193.94/

This is because DNS server still point to OLD shared IP address.

So i edited DNS of this domain and pointed it to new dedicated IP address.

Start > Programs > Administrative Tools > DNS

DNS > SERVER8 > Forward Lookup Zone > car-toonies.co.uk

Change IP address of Entry

car-toonies.co.uk
*.car-toonies.co.uk
www.car-toonies.co.uk

Now the domain is pointing to its dedicated IP and everything works fine.

Now need to get SSL for this domain.

Monday, September 19, 2005

Apache not working, server can't ping outside

Today i loged into Image Hosting server, getting too SSH was very difficult even from a server in US because of heavy bandwidth usage. The site was maxing at 10 MBPS port. After several try i got in to the server.

I want to delete some heavy hotlined images, so i can preven bandwidth usage from maxing to 10 MBPS all the day, will also help in serving images faster.

Normally i do not enable apache log, so i edited httpd.conf and uncommented the line CustomLog. After that i stoped and started apache

apacheclt stop
apachectl start

Stop and start went well, but after starting apache is not working, ps -aux shows no httpd.

I tryed to ping an out side domain yahoo.com from the server, it fails, it seems some problem with DNS servers, so i checked /etc/resolv.conf

server18# cat /etc/resolv.conf
domain temp
nameserver 66.96.80.43
server18#

i tryed nslookup on name server IP to see if it can resolve the domain.

# nslookup
> server 66.96.80.43

But it can't resolve any domains, seems DNS server of DC is down, so contacted support on live support desk, they ping the name servers told me name servers are working fine, i told them ping is ok, but nslookup fails, they asked to submit support ticket for Level 2 support.

After submiting support ticket, they solved the problem by adding another name server to /etc/resolv.conf

Sunday, September 18, 2005

Compiling FreeBSD Kernel with QUOTA for Cpanel

On new FreeBSD server, it is found that all domains say unlimited web space available. So i tryed to fix it with /scripts/fixquotas but it says support for QUOTA need to be enable in the Kernel.

To enable this we have to rebuild kernel with

options QUOTA

Next you will need to enable disk quotas in /etc/rc.conf. This is done by adding the line:

enable_quotas="YES"

To enable quotas on a file system, add the userquota and groupquota option to the options field in the /etc/fstab entry for the file system you want to enable quotas on. For example:

/dev/da1s2g /home ufs rw,userquota,groupquota 2 2

To verify quota is set, run the command

quota -v


Rebuilding Kernel


cd /usr/src/sys/i386/conf
cp GENERIC SERVER20


Now edit the file SERVER20 and added

options QUOTA

Now building Kernel

config SERVER20
cd ../compile/SERVER20
make depend
make
make install

reboot the server.

Now uname -a shows new kernel

$ uname -a
FreeBSD server20.hosthat.com 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun Sep 18 06:46:40 GMT 2005 root@server20.hosthat.com:/usr/src/sys/i386/compile/SERVER20 i386
$


$ quota -v
Disk quotas for user ltct-0107 (uid 1002):
Filesystem usage quota limit grace files quota limit grace
/home 28 0 0 14 0 0
/usr 0 0 0 0 0 0
$


To enable Quotas in Cpanel run

/scripts/initquotas

Saturday, September 17, 2005

MySQL on FreeBSD Cpanel Server

On new FreeBSD 5.4 Cpanel server, i tryed to transfer a new site (www.webhostingneeds.com) from another server for testing. The site uses Mambo CMS, but after moving the site it stoped working. Site shows offline page. So i checked and found MySQL server was not running on the server.

I tryed to restart MySQL Server through WHM services. Got following error

Attempting to restart mysql Waiting for mysql to restart.... . . . . . . . . . . finished.
mysql statusmysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").


It seems the problem was because i selected MySQL version 4.1 with OLD_PASSWORD in WHM. That says

MySQL Version to use (you must run Software/Update Server Software (or /scripts/mysqlup) for this to take affect. You should then run buildapache/easyapache after changing this option. You may also need to run /scripts/perlinstaller --force Bundle::DBD::mysql. Updating from mysql 4.0 to mysql 4.1 is not automaticlly reversable. You should backup your databases if you think you might wish to downgrade in the future.

So i run

/scripts/mysqlup

Installation went well, but MySQL won't sratr.

server20# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
server20#


So checked the error log at /var/db/mysql/server20.hosthat.com.err


050917 7:17:18 [Warning] mysql.user table is not updated to new password format; Disabling new pa
ssword usage until mysql_fix_privilege_tables is run
050917 7:17:18 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second'
doesn't exist trying to live without them
/usr/local/libexec/mysqld: ready for connections.
Version: '4.1.10a' socket: '/tmp/mysql.sock' port: 3306 FreeBSD port: mysql-server-4.1.10a
050917 7:17:21 [Note] /usr/local/libexec/mysqld: Normal shutdown


So i run /usr/local/bin/mysql_fix_privilege_tables

server20# cd /usr/local/bin/
server20# ./mysql_fix_privilege_tables
This script updates all the mysql privilege tables to be usable by
MySQL 4.0 and above.

This is needed if you want to use the new GRANT functions,
CREATE AGGREGATE FUNCTION, or the more secure passwords in 4.1

Got a failure from command:
/usr/local/bin/mysql --no-defaults --force --user=root --host=localhost --database=mysql
Please check the above output and try again.

Running the script with the --verbose option may give you some information
of what went wrong.

If you get an 'Access denied' error, you should run this script again and
give the MySQL root user password as an argument with the --password= option
server20#


And it solved problem.

To auto start MySQL at boot time, added

mysql_enable="YES"

to /etc/rc.conf

Rebooted the server and MySQL is working fine now.

So i deleted the site www.WebHostingNeeds.com from the server and transfer it again. Now after the site transfer, everything is working fine.

Friday, September 16, 2005

New FreeBSD 5.4 Cpanel Server

Today got new FreeBSD 5.4 server with Cpanel.

HostName: server20.hosthat.com
OS: FreeBSD 5.4
CPU: Intel P4 3.2HT
RAM: 1024MB
Control Panel: Cpanel + Fantastico

This is the first time i buy a FreeBSD server with Cpanel. All other FreeBSD servers are with out any control panel, just run Apache, MySQL and FTP server. All Cpanel servers are with verious distros of Linux. FreeBSD works great on my servers with no control panel, one of the srever is at load 10, still works great. Hope it will work well with Cpanel too.

Unlike Linux Cpanel servers, i found some errors in inital setup like syntax error in named.conf causing BIND to fail and Pure-ftpd server not starting at boot, with some modification in configuration files, i was able to fix these errors.

This new server come with Fantastico, after installation it gives error on clicking fantastico button on Cpanel.

The server was not able to find the document (./frontend/x/fantastico/index.php) you requested


Fixed with

cd /usr/local/cpanel/base/frontend/x
ln -s /usr/local/cpanel/3rdparty/fantastico

XPanel Installation on FreeWebPros.net

XPanel is a Control Panel for running free web hosting service on Linux servers. This is one of the best solution available for those who want to start free web hosting service. XPanel can provide free web hosting with sub domains, support advertisements on footer, header or popup ads.

http://www.xpanel.com

Today one of the client want this installed on Cpanel server. This is my second installation of XPanel, so it was not a problem for me. Only problem was the client give me some IP's that was not pointing to the server. It seems client have added this IP himself with out contacting data center. Anyway i managed to make one free IP and finished installation with that.

Sunday, September 11, 2005

Bulk Parking multiple web sites in Cpanel

Today one client want to park 75 domains to his web site. This was already parked, but it was lost after he moved the server. he give me a list of sites he want to park to his existing web site.

So i checked if there any easy way to do this other than usual WHM, where you need to add one by one.

I found /scripts/park can do this. I have done following (domains changed). In this example, we park several domains to the domain name flashwebhost.com, that is when a visitor goes to parked-domain-1.info or parked-domain-2.info he sees FlashWebHost.com

/scripts/park flashwebhost.com parked-domain-1.info
/scripts/park flashwebhost.com parked-domain-2.info
/scripts/park flashwebhost.com parked-domain-3.info
/scripts/park flashwebhost.com parked-domain-4.info


After doing running this in SSH, i can see the DNS entry added in the server, but sites not showing FlashWebHost.com

I checked apache configuration file. I could not find any entry for this domain in virtualhost section of the domain flashwebhost.com, so i edited httpd.conf

vi /usr/local/apache/conf/httpd.conf

and added following lines to virtualhost section of the domain flashwebhost.com

ServerAlias parked-domain-1.info www.parked-domain-1.info
ServerAlias parked-domain-2.info www.parked-domain-2.info
ServerAlias parked-domain-3.info www.parked-domain-3.info
ServerAlias parked-domain-4.info www.parked-domain-4.info

Thursday, September 08, 2005

Stop Nobody Spamers Using PHP and Perl Scipts

Today one client told some of his client is sending spam from his server and want to track the abuser. The spamer may be using a PHP or Perl script. By default, PHP and Perl scripts run as user nobody, so it is impossible to know who is sending the spam emails if the sites URL is not in the spam email. For example if you host a site Domain-1.com and that site send spam mails for promoting another site Domain-2.com, we will not able to track such spam.

Spam is illegal and we have to prevent that, or shortly your Server IP will get black listed and data center will unplug the server as they don't want to host illegal spamer.

So the solution is to run PHP and Perl scripts in Suexe mod. With Cpanel, you can enable this through WHM easily. But some of the pooerly coded scripts will not work with suexe.

The solutions are

suPHP

suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.

http://www.suphp.org/

Replacing Sendmail with Perl/PHP script

More details can be found at

http://hostonnet.netfreehost.com/hostonnet-ftopic280.html

Modify PHP Source Code

This is done by editing mail.c file in PHP source code and install modified PHP on the server. This only work with PHP scripts that use mail function to send mail. If the PHP scripts use SMTP or sendmail directly, this will not work, most of the PHP scripts uses mail function to send emails.

Patch can be downloaded from

http://choon.net/php-mail-header.php

If you need any help in stop nobody spaming, check out our server administration service at

http://netfreehost.com/services/

Windows 2003 Components

Today one of the client brought Windows 2003 server and have to install and configure, IIS, ASP, ASP.NET, PHP, MySQL, HELM Control Panel, etc...

After installation, following ASP Component installed. I could not find the download url for "W3Jmail Free by Dynamic" google search shows HostOnNet.com and many of the resellers.


ASPeMail Standard
http://www.aspemail.com/index.html

WhoisDLL
http://www.sloppycode.net/Asp/Components/
http://www.sloppycode.net/Downloads/ASP/whoisdll.zip

Dundas Upload
http://aspalliance.com/dundas/default.aspx
http://aspalliance.com/download/AspUpload.EXE

AspTear 1.0
W3Jmail Free by Dynamic

Saturday, September 03, 2005

Removing Server Status Link from Cpanel

Today one user asked how to remove "Server Status" link from Cpanel on WHT. So i tryed to find it myself. Here is what i done.

Step 1

Login to server as root

Step 2

Change to Cpanel Skin folder

cd /usr/local/cpanel/base/frontend/x

x - because i use x skin on my servers. This is free skin by cpanel and is the default one. If you use other skin, change x with your own skin name.

Step 3

Edit index.html file with any text editor, i use vi

vi index.html

Step 4

Find following HTML code and delete it

<tr><td class="index1" width="120" nowrap><cpanel langprint="TServiceStatus"></td><td class="index2"><a href="status.html"><cpanel langprint="INDXPerlView"></a></td></tr>

Take a backup of index.html before doing this.

NetFreeHost.com script installation service

NetFreeHost.com now offers PHP, Perl and CGI script installation services.

You don't have to know anything about scripts, just select the script and it get installed at cheap and affordable rates. Services includes PHP, Perl, CGI, ASP Script installation, Dedicated Server Administration, Firewall Installation and configuration, web server installation.

You can find more at

http://www.netfreehost.com/script_installation/