Archive for November, 2011

Install spf records for all accounts on cPanel server

Saturday, November 26th, 2011
Limited Offer – FREE Hosting for Life!

Order any hosting package for a period of two years and get it FREE for life!

Command to install spf record on single cPanel account.

/usr/local/cpanel/bin/spf_installer cPanel_username

Put actual username in place of cPanel_username

Instead of installing spf records on cPanel accounts one by one use the following script to install it in one step:

cd /var/cpanel/users

for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/spf_installer $i ;done

 

Related Posts:

  • No Related Posts

db4 error

Saturday, November 26th, 2011

 

Error: db4 error(-30974) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch

Solution:  Remove the corrupted db file by ,

rm -f /var/lib/rpm/__db*

Then rebuild rpm database by command,

rpm –rebuilddb -v -v

That’s it. icon smile db4 error

 

 

Related Posts:

  • No Related Posts

Change php version through .htaccess

Thursday, November 24th, 2011

If there are two php versions compiled on server and you wish to use php version for your domain other than the default one then make the  use .htaccess for this.

For example default php version on server is set to php 4 then all domains by default will use php4.  But certain applications installed on a domain runs only under php5 then in that case it is necessary that domain should use php5

Open .htaccess by any suitable editor like vi, pico etc. Put the following code into it.

Server without suphp enabled

AddType application/x-httpd-php5 .php .htm .html

Server with suphp enabled

AddHandler application/x-httpd-php5 .php .htm .html

Same way you can enable php4 if the default php version is php5. Just put the php4 instead php5 in above code.

 

 

Related Posts:

  • No Related Posts

Activate cPanel license from shell

Thursday, November 24th, 2011
Limited Offer – FREE Hosting for Life!

Order any hosting package for a period of two years and get it FREE for life!

Many users experience the following error while accessing WHM/cPanel

License could not be activated.

Following are some reasons due to which this error can be occurred.

1)If server hostname has been changed

2)If primary IP of cPanel server for which cPanel license was activated, has been changed.

3)Server firewall.

Here are some basic steps to fix this error.

Verify that cPanel license is activated at http://verify.cpanel.net.

If link shows that WHM is licensed then verify server hostname , primary IP just to ensure if it hasn’t been changed. Correct the primary IP address , hostname if it found to be changed.  Stop/start server firewall.

If server IP, hostname is correct then check if server’s primary IP address match with the IP address of license. For that type the following command from shell.

curl http://www.cPanel.net/showip.cgi

If output gives other IP address then you need to license that IP.

If everything appears to be corrected then just activate cPanel license from command line.

[email protected] [~]# /usr/local/cpanel/cpkeyclt

Hope you shouldn’t see any error at this time.

 

 

 

 

Related Posts:

  • No Related Posts

Password protected directrories

Thursday, November 24th, 2011

Password protection restricts access to particular folder. Only authenticate users can access password protected folder.

 

Here are few steps with which you can enable password protection

 

1)Login to cPanel.

2)Click on icon Password Protect Directories. Directory Selection window will appear. 3)Click on radio button of web root and then click on Go button.

4)Click on folder name for which you wish to enable password protection.

5)Enable checkbox Password protect this directory.

6)Put proper name in the field Password protect this directory and click on save button.

 

Here you done with the password protection.

 

Now you need to add user with the password to access protected folder.

 

7)In the field username put username

8′) Then put the password in New password field, repeat the password  in Password (Again) field and then click on button Add/modify authorized user

Now try the URL just to confirm that password protection is working for desired folder. If you see username / password prompt then it indicate that password protection is enabled.

 

Quick steps to enable password protection from shell.

 

Create .htaccess file in folder which you wish to make it password protected and put the following content

 

AuthName “Restricted Area”
AuthType Basic
AuthUserFile /home/username/.htpasswd
<Limit GET POST PUT>
Require valid-user
</Limit>

 

Username should be cPanel user of the domain.

 

Now type the following command in shell to add username and password

 

htpasswd -c /home/username/.htpasswd testuser.

 

In apache 2.2 you may need to use absolute path of htpasswd, /usr/local/apache/bin/htpasswd

That will be prompted for new password. Put the desired password.

The newly username and password will be saved in /home/username/.htpasswd

Now open browser to access secure part of the webite just to ensure that you are prompted for username and password.

 

 

 

Related Posts:

  • No Related Posts

Wildcard DNS and Wildcard SSL

Wednesday, November 23rd, 2011

Wildcard SSL

A wildcard ssl use to secure not only primary domain but also multiple subdomains added on it. SSL certificates are usually issued to fully qualified domain names (FQDN), so if you want to access your domain at secure link with www and without www then you would need two separate SSL Certificates.
There is no need of separate ssl certificate for www.domain.com and domain.com if you purchase wildcard ssl.

You can access a domain with www or without www with the wildcard SSL.
Any subdomain added on it can be accessible at secure link with the same wild card ssl installed at primary domain.

Wildcard DNS

A wildcard DNS record redirects requests for non-existent domain names (Usually subdomains that are not exists) to primary domain name.
For example if you type xyz.domain.com it will redirects the requets to domain.com.

A wildcard DNS record is specified by using a *  as the leftmost part of a domain name, e.g. *.domain.com.

For wildcard ssl, domain should have wildcard dns enabled on it. Follow the few steps here and you will be able to enable wildcard dns for domain on cPanel server.

A typical dns zone file of any domain on cPanel server,

; cPanel 11.28.60-RELEASE_50962
; Zone file for domain.com
$TTL 600
@      600      IN      SOA     ns9.dns.com. admin.domain.com. (
2011020102      ; serial, todays date+todays
86400           ; refresh, seconds
7200            ; retry, seconds
3600000         ; expire, seconds
86400 )         ; minimum, seconds

domain.com. 600 IN NS ns9.dns.com.
domain.com. 600 IN NS ns10.dns.com.

domain.com. IN A x.x.x.x

localhost.domain.com. IN A 127.0.0.1

domain.com. IN MX 0 domain.com.

mail IN CNAME domain.com.
www IN CNAME domain.com.
ftp IN A x.x.x.x
cpanel IN A x.x.x.x
whm IN A x.x.x.x
webmail IN A x.x.x.x
webdisk IN A x.x.x.x

Open the dns zone file of domain by vi editir or from WHM >  Main >> DNS Functions >> Edit DNS Zone and simply add the entry

*.domain.com IN A x.x.x.x

Save the file and restart the named sevice.

Now one more change need to done in apache.conf but here you need to add one more entry in serveralias.

Open apache configuration file on server by vi editor as vi /usr/local/apache/conf/httpd.conf. Add serveralias for domain as
*.domain.com

<VirtualHost x.x.x.x:80>
ServerName domain.com
ServerAlias www.domain.com *.domain.com
DocumentRoot /home/cpanel_user/public_html
ServerAdmin [email protected]

Save the changes and restart apace server.  Once this done you are free to install wildcard ssl on domain

Related Posts:

  • No Related Posts