UnixServerAdmin

Server Administration & Management

How to disable strict zone checking in bind in cPanel

Recent versions of Bind distributed by RedHat and CentOS enable strict zone checking at startup time. This setting can potentially cause problems for Bind users with a large number of zone files or syntax errors in individual zone files.

As a result, users may experience an inability to restart Bind after a shutdown. cPanel has, immediately, produced and distributed an autofixer for this condition. This repair will run automatically on all systems with updates enabled. However, cPanel checks only occur at specific times and depending upon update schedules, users experiencing issues restarting Bind may benefit from manually executing the code to disable strict zone checking. If you are facing this problem,
you may safely execute the autofixer by running the following command:

# /scripts/autorepairbind_disable_checkzone

Advertisements

May 24, 2012 Posted by | cPanel, DNS | , , | Leave a comment

How to fix ”DNS zone deleted by mistake“ on cPanel servers

If you delete a dns zone file for mistake in Cpanel/WHM and the account has lot of subdomains , then it can get very time consuming to fix this manually , by first adding the zone file and then adding entries for individual subdomains, below trick can fix this :

* Rename the domain name from WHM to some other name temporairily , which will create the zone file with new name for         main domain and will add zone entries for all subdomain as well.

* Now rename the domain name again back to original , and here you go , with complete zone file back in action.

May 9, 2012 Posted by | cPanel, DNS | , , | Leave a comment

How to add nameservers from shell

Most of the time on cPanel dedicated server we add nameservers from WHM but some time we are not able to access WHM. In that case we can add nameservers from shell by using root login details.

Login in to server as root user and run following commands.

# /scripts/adddns –domain ns1.your_domain.com –ip=X.X.X.X

# /scripts/adddns –domain ns2.your_domain.com –ip=X.X.X.X

You can use your domain name instead of your_domain.com in above command with the respective ips which you want to use for your nameservers.

# /etc/init.d/named restart

December 14, 2011 Posted by | DNS | , | Leave a comment

How to close openDNS server

Here is the steps to close the openDNS in the server:-

1. login to your server as root

2. Open the named configuration file.

# vi /etc/named.conf

3. Look for // query-source address * port 53;  below this add the following line:

recursion no;

4. save the file and restart named service.

# service named restart

December 11, 2011 Posted by | DNS | , | Leave a comment

How to Pointing a sub-domain to folder outside public_html

Issue : When you create a sub-domain, cPanel points it to the corresponding folder under public_html by default. How to point it to a folder outside the public_html?

Solution : This cannot be done via cPanel/WHM but can be achieved if you have ‘root’ SSH access to the server.

1. Open the apache configuration file

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

2. Search for the virtual host entry for your sub-domain.

3. Edit the document root of your sub-domain to match the desired location.

4. Save and Exit; Restart apache.

# /etc/init.d/httpd restart

Note : cPanel rebuilds httpd.conf from userdata files and its overwritten on every cPanel update, on every account creation, subdomain addition, or any such activity related to apache and any manual changes you make will be overwritten. To make permanent changes to a subdomain’s root folder :

1. Edit the file /var/cpanel/userdata/<username>/subdomain.domain.com file, change the path and save it.

# vi /var/cpanel/userdata/username/subdomain.domain.com

2. Run /scripts/rebuildhttpdconf

# /scripts/rebuildhttpdconf

3. Restart apache.

# /etc/init.d/httpd restart

October 13, 2011 Posted by | Apache, DNS | , , | Leave a comment

How to Putting add-on domains on dedicated IPs

Issue : The main domain and the add-on domains need to be on different dedicated IPs.

Fix : This cannot be done directly through cPanel/WHM .

1. If suppose your cPanel account username is “USER” and domains are:

maindomain.tld
addondomain1.tld
addondomain2.tld

2. Then you have to edit the following files using vi editor

# vi /var/cpanel/userdata/USER/maindomain.tld

# vi /var/cpanel/userdata/USER/subdomain1.maindomain.tld

# vi /var/cpanel/userdata/USER/subdomain2.maindomain.tld

3. Change the IP field to in each to your desired one. Then you have to rebuild apache using

# /scripts/rebuildhttpdconf

4. Restart apache service.

# /etc/init.d/httpd restart

5. Edit DNS zone file of each domain and point A record to the new IP.

That should be it! All your domains should work flawlessly and you should also be able to install SSL , if required.

October 7, 2011 Posted by | cPanel, DNS | , , | Leave a comment

Logs files in linux (cPanel)

In a cPanel server, you may find logs are often stored differently comapring a control panel less server. Even Plesk saves logs in different paths. Here is a list of services and their log path that may help you finding the logs.

Apache
/usr/local/apache/logs/access_log
/usr/local/apache/logs/error_log
/usr/local/apache/domlogs/example.com

MySQL
/var/lib/mysql/hostname.err
hostname should be resemble your hostname.

Exim
/var/log/exim_mainlog
/var/log/exim_paniclog
/var/log/exim_rejectlog

Courier-IMAP
/var/log/maillog

cPanel
/usr/local/cpanel/logs/error_log
/usr/local/cpanel/logs/access_log
/usr/local/cpanel/logs/license_log
/usr/local/cpanel/logs/login_log
/usr/local/cpanel/logs/stats_log

Pure-FTP
/var/log/messages
/var/log/xferlog  (symlinked to /usr/local/apache/domlogs/ftpxferlog)

System (cron, syslog, named, etc)
/var/log/messages
/var/log/boot.log
/var/log/cron
/var/log/dmesg

Security (ssh, ModSecurity, etc)
/var/log/secure
/usr/local/apache/logs/audit_log
/var/log/messages

August 15, 2011 Posted by | Apache, cPanel, Cron, DNS, Exim, Mod_Security, MySQL, Pure-FTPd, SSH, Tips & Tricks, Unix/Linux | , , , , , , , , , , | Leave a comment

Domain, Subdomain, Addon domain OR Parked domain not able to remove from cPanel

Sometimes, when you want to remove a domain, sub-domain, addon domain, or even parked domain, you will found out the account is not belong to the owner of you or you might found out the domain is existed but does not belong to any owner.

With this case, you may firstly check for the ownership from the SSH with root.

# /scripts/whoowns domain

where domain should be the domain name that you want to find who own it. If you are not able to find any result from the above script. Run the following script(each a line).

# /usr/local/cpanel/bin/userdata_update

# /scripts/rebuildhttpdconf

June 5, 2011 Posted by | cPanel, DNS | , | 4 Comments

Error from park wrapper_ domain.com is already configured

On a cPanel server if you get the error: Error from park wrapper: domain.com is already configured while adding an add-on domain under cPanel. Make sure to remove the domain.com entries from following files:

# vi /var/named/domain.com.db

# vi /etc/httpd/conf/httpd.conf

# vi /var/cpanel/users/username

# vi /etc/userdomains

# vi /etc/localdomains

Renaming or commenting will not help; you will have to remove the entries completely. Try now.

This worked for me.

June 2, 2011 Posted by | cPanel, DNS | , | 3 Comments

How to setup rDNS in cPanel

I’ve seen so many people say on there that you MUST contact the data center for each rDNS entry you need. This is totally false and untrue in most cases. Most data centers can add your nameservers, and their ips to have access to reverse the address yourself. This can be done WITH or WITHOUT cPanel. You must email the data center and have them authorize your name servers for reverse access before you attempt this.

Some information to start with: Occets

An IPv4 IP address is sparated into 4 occets each separated by a period. So 12.21.31.xxx being our ip, 12 is the first occet, 21 is the second, and so on and so fourth.

Ok now to the rDNS with cPanel.

1. First you must create a in-addr.arpa zone. Goto dns functions and click add a dns zone.

2. Now this is where you use the occet knowledge. You have an IP block from your dedicated provider.

3. For this article we will use 12.21.31.xxx. You will most likely want to choose system or root to manage this domain as you probably don’t want your customers messing with rDNS.

4. In the IP Box we will type the main IP Address for accessing the server.

5. In the domain box we will type: 31.21.12.in-addr.arpa

6. Notice that the numbers are still read forward but the fourth occet has been dropped and third occet has been placed first, second occet in the middle, and first occet in the end. This is very important for rDNS to work right.

7. Now click submit.

8. You now have your PTR zone. It should have your ns1.* and ns2.* name servers listed. As well as a mx entry.

9. Now were ready to actually reverse the ip address. This is where the fourth occet of the ip will be picked back up. For the rest of the tutorial we’ll assume our ips are 12.21.31.001-12.21.31.003 (Yes I know these aren’t real ips as the last occet number is wrong this is to not disturb any ISPs)

10. Go to the bottom of your edit dns for this zone.

11. Enter your fourth occet of the ips you wish to reverse in the first box in each row in the bottom section of this page. For this tutorial this is 001, 002, 003.

12. Switch the drop down for each one to PTR.

13. Enter what you wish to reverse in the box just to the right of the drop down we selected PTR in. We’ll use ssh.mydomain.com, ns1.mydomain.com and ns2.mydomain.com for this.

Each address must end in a period such as:
ssh.mydomain.com.
ns1.mydomain.com.
ns2.mydomain.com.

14. This period is important as it tells this zone this is the end of what were reversing, and causes BIND to not add the zone file name onto the end.

So now what we have in first three rows at the bottom of page should look like this.

001 14400 IN PTR ssh.mydomain.com.
002 14400 IN PTR ns1.mydomain.com.
003 14400 IN PTR ns2.mydomain.com.

Now click save. And your done. You’ve just set up three ips for reverse dns. Remember to be patient. It can take a bit for the reverse entry to traverse the world. So it doesn’t always resolve immediately, tho most hosts only take a couple seconds.

March 2, 2011 Posted by | cPanel, DNS | , , | 2 Comments

Domain not able to resolve to IP in cPanel

sometimes domain is not able to resolve to IP address in cpanel, Here is following steps to resolve this type of problem :-

# mv /etc/named.conf /etc/named.old

# /scripts/rebuildnamedconf > /etc/named.conf

# service named stop

# killall -9 named

# /scripts/fixndc

# /scripts/fixndc

February 23, 2011 Posted by | cPanel, DNS | , | Leave a comment