Disable Recursive DNS in cPanel server.

Edit the /etc/named.conf file
After the “CONTROLS” section, add the following:

acl “trusted” {
127.0.0.1;
YOUR IP 1;
YOUR IP2;
};

options {
directory “/var/named”;
version “not currently available”;
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };
dump-file “data/cache_dump.db”;
statistics-file “data/named_stats.txt”;
memstatistics-file “data/named_mem_stats.txt”;

};

Remove the other “OPTIONS” section in your named.conf file.

You can check the named conf sysntax using the following command.

# named-checkconf /etc/named.conf

Then

#rndc reload

#/etc/init.d/named restart

How to Add SRV record?

The information provided to you for adding SRV record should be looking like as follows:

My SRV record information
==================
Record Type: SRV
Service: _mytestingsrv
Protocol: _tcp
Port: 443
Weight: 0
Priority: 0
TTL: 300
Name: yourodmain.com
Target: xyz.online.test.com
===================

There is an order to add these records in zone file. Go to WHM >> Home » DNS Functions » Edit DNS Zone. Open the particular domains zone file. Then choose a new field to add up record, select SRV from the selection list.
Now the order should be as “service.protocol 300 IN SRV Priority Weight Port Target(in Hostname field)”

According to my above record information, I have entered the SRV record as follows:

_mytestingsrv._tcp 300 IN SRV 0 0 443 xyz.online.test.com.

Click save and check SRV record for the domain using DIG command 🙂

====================
$ dig srv _mytestingsrv._tcp.yourodmain.com

;; ANSWER SECTION:
_mytestingsrv._tcp.yourodmain.com. 288 IN SRV 0 0 443 xyz.online.test.com.
=====================

Bug in PHP release version.

I came across the following error while “make” process during custom compilation of PHP. This is bug in its release which can rectified by applying a patch.

============
/usr/local/src/php_sources/php-5.4.5/ext/dom/node.c: In function dom_canonicalization:
/usr/local/src/php_sources/php-5.4.5/ext/dom/node.c:1898: error: dereferencing pointer to incomplete
============

Download the patch “php1.patch” from the below URL.

http://www.mediafire.com/?ii19zwu444z4o1z

and execute the following command in the php source directory.

============
@Host [/usr/src/php-5.2.17]# chmod 755 php1.patch
@Host [/usr/src/php-5.2.17]# patch -p0 < php1.patch
patching file ext/dom/node.c
Hunk #1 succeeded at 1950 (offset 55 lines).
patching file ext/dom/documenttype.c
Hunk #1 succeeded at 215 (offset 10 lines).
patching file ext/simplexml/simplexml.c
Hunk #1 succeeded at 1343 (offset -74 lines).
=============

Now do compilation again, error is corrected 🙂

500 No response while loading cPanel

Sometimes the following would be the error generates when we try to load the cPanel of an account.

==================
[2013-04-07 08:15:05 -0500] warn [cpanel] Failed to load cPanel user file for ‘cPanel_username’ at /usr/local/cpanel/Cpanel/Config/LoadCpUserFile.pm line 32
Internal Server Error: “GET /cpsess7952893738/frontend/x3/index.html?post_login=88039081253834 HTTP/1.1” 500 No response from subprocess ( (cpanel)) with exit signal: 255
==================

This is a permission or ownership issue with the cpanel user file present in the path /var/cpanel/users. It should be corrected as follows:

=================================================
root@server [~]# ll /var/cpanel/users/cPanel_User_Name
-rw-r—– 1 root cPanel_User_Name 949 Oct 16 01:37 /var/cpanel/users/cPanel_User_Name
=================================================

load cPanel now 🙂

HTTP not working, but HTTPS does in NGINX

Found an issue regarding with http url of site is not working, but sametime https does. Here the Nginx works as a Front End Proxy on port 80 for Apache.

——————-
tcp 0 0 IP:80 0.0.0.0:* LISTEN 2023/nginx
tcp 0 0 IP:80 0.0.0.0:* LISTEN 2023/nginx
tcp 0 0 IP:80 0.0.0.0:* LISTEN 2023/nginx
tcp 0 0 IP:8081 IP:38574 ESTABLISHED 24791/httpd
——————-

Troubleshoot part
===========
Section 1:

————-
I tried first to switch to apache as main as follows, to verify if is clearly an issue only with nginx but not apache.

* Took a backup of apache conf with current date.
* vi /usr/local/apache/conf/httpd.conf and set parameter ‘Listen 0.0.0.0:8081’ to ‘Listen 0.0.0.0:80’ under the line “# Defined in /var/cpanel/cpanel.config: apache_port”. Also replaced all ‘8081’ entries to ’80’, along with NameVirtualHost and in the virtual host.
* vi /var/cpanel/cpanel.config and set parameter ‘apache_port=0.0.0.0:8081’ to ‘apache_port=0.0.0.0:80’. Then execute the following script to make the changes in effect.

/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

* /etc/init.d/nginx stop
* /etc/init.d/httpd restart

Now apache would run as main webserver without any Front End proxy. Check the http url is loading fine or not. If it is working, the issue is regarding with nginx server.

Section 2:
————-
* Check the nginx configuration for syntax errors.
root@host [~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
* Since I found the synax check is ok with nginx, turned by attention towards vhost entry for this domain in nginx.
* In the path, “/etc/nginx/vhosts” I could see vhost files for all domains but not the particular domain’s in question.
* I created one manually as follows:

—————————————————————————
root@host [~]# cat /etc/nginx/vhosts/domain.com
server {
error_log /var/log/nginx/vhost-error_log warn;
listen domainIP:80;
server_name domain.com www.domain.com;
access_log /usr/local/apache/domlogs/domain.com-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/domain.com combined;
root /home/cPanel_username/public_html;
location / {
location ~.*.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|
flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 1d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache “HIT from Backend”;
proxy_pass http://domainIP:8081;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://domainIP:8081;
include proxy.inc;
}
location ~ .*.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://domainIP:8081;
include proxy.inc;
}
location ~ /.ht {
deny all;
}
}
—————————————————————————

* Now I tried to switch nginx back as Front proxy. Reverted the changes made in “/var/cpanel/cpanel.config”, “/usr/local/apache/conf/httpd.conf”.
* Then make sure you executed the command “/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings” to make the changes in cpanel.config to be in effect. Then restart apache and start nginx.

You can see http url works as a charm 🙂

Please note that, next time when you face the same issue, you can directly go to section 2 for fast troubleshooting and closing the ticket.