Pages

Showing posts with label cPanel/WHM. Show all posts
Showing posts with label cPanel/WHM. Show all posts

Friday, April 10, 2026

 

How to rebuild corrupted userdata files in cPanel/WHM


cPanel uses userdata files to keep information about addon domains, parked domains, IPs, PHP versions used by accounts etc. If you came to the conclusion that the cPanel userdata files are corrupted, you can rebuild them. The process detailed below will be possible only if you have a valid httpd.conf file.

How to rebuild corrupted userdata files in cPanel/WHM
1. Log into your cPanel/WHM server with the root credentials

2. Move the existing userdata files to a new location. Use:

mv /var/cpanel/userdata /var/cpanel/userdata-original


3. Re-create the userdata directory with this command:


mkdir /var/cpanel/userdata 

Thursday, October 31, 2019

How to block an IP?

If you want to stop someone from visiting your website, you can use the IP Blocker interface within cPanel which allows you to block access to your site for one or more IP addresses or fully qualified domain names (FQDNs).

You can easily block an IP in cPanel by following these steps:

1) Log into cPanel.
2) Look for the “SECURITY” section and click on “IP Blocker” icon.
3) You can add a single IP, an IP range or a domain name to the block list, click the “Add” button to set the block.
4) If you scroll down on the same page, you’ll see a list of all the blocked IPs, from here you can also delete an IP from the block list.

Rock on.

Friday, May 18, 2018

Install Memcache onto cPanel

Memcached is a service that allows entire database tables to be stored in memory, drastically speeding up queries to those tables and alleviating database load. In WordPress and W3 Total Cache, the Memcached module allows you to store all cache tables in memory.
This guide can be used to set up Memcached on CentOS.

To install memcached on cpanel server, login to SSH as user root, run

   
yum install memcached
Enable memcached start on boot with
systemctl enable memcached
Start memcached with
   
systemctl start memcached

Enable memcached PHP module
For PHP applications to use memcached, we need PHP module installed. To install login to WHM as user root, go to
Home > Software > Module Installers



WHM/Cpanel Increase The Size Of /tmp (/usr/tmpDSK) Partition

You may have noticed that cPanel’s default partition size for /tmp is
512 MB, which in some cases can be way too small. And sometime you probably get this report email:
Drive Critical: /usr/tmpDSK (/tmp) is 100% full
Although cPanel automatically deletes the unused files, the /tmp would be getting full very quickly on a busy server.
The /tmp partition on cPanel servers, assuming it was the one cPanel created and not one you did yourself, is a file-based partition that can easily be resized.
By default on most servers, /tmp is the temporary dumping place for a lot of things, for example:
  • PHP session files
  • PHP temporary file uploads
  • MySQL temporary files
  • Cache files for certain Apache modules


Friday, January 26, 2018

How to Restore a Full cPanel Backup to VPS

Backup restoration is one of the essential tasks every server administrator must know how to perform. Under cPanel it is really simple to restore full backup of one account. In this tutorial we are going to show you two very easy methods about how to restore a full cPanel backup to a Linux VPS.

Restore Full cPanel Backup via WHM

Saturday, December 30, 2017

How to enable mod_deflate globally in cPanel/WHM

This will be a quick one folks.  The Apache module mod_deflate helps in reducing the size of the information sent to a user, by compressing things prior.  It seems to work very well.  To test if your site already has mod_deflate installed and working, you can go here:

http://www.whatsmyip.org/http_compression/

To enable mod_deflate on your WHM / cPanel server, make sure you run EasyApache through WHM, and select to install mod_deflate.  Once done, you’ll notice that it is not active globally.  In your cPanel control panel for your domain, you should notice that under “Software / Services” an icon called “Optimize Website” is now there.  This is how you control mod_deflate on a per user basis.

If however, you wish enable it globally, so that all websites on your server can benifit from this, you need to venture back into WHM, and this time go to:

Services Configuration >> Apache Configuration >> Include Editor >> Post VirtualHost Include, and select All Versions

Saturday, September 17, 2016

cPanel performance tweaks, Memory Consumption

Every cpanel server should be need to optimize according to your server usages, I hope the following articles will help to improve your cpanel server performance.

Run your cron jobs at off peak hours.

Stopping SpamAssassin

Go to WHM > Server Configuration > Tweak Settings > Disable Spamd

And:

Go to WHM > Service Manager > Disable Spamd

Disable Anonymous FTP

Sunday, January 3, 2016

cPanel force remove an ip address

If you want to remove an ip address in cPanel, and sometimes the remove button is not there, just edit the file /etc/ips, remove the ip address in question, and then do a restart of the system aliases.

/etc/rc.d/init.d/ipaliases restart

This will work on cPanel / linux/centos

Should save you some headaches.

Enjoy!

Previous value removed by cPanel transfer auto-merge

So i have been doing a hardware upgrade, and during the migration of the accounts, the target server named zone files got polluted with stuff like this:

( ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; 2015112200 ;Serial Number ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; 43200 ;refresh ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; 7200 ;retry ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; 2419200 ;expire ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; 86400 ;minimum ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT
; ) ; Previous value removed by cPanel restore auto-merge on 20151223145307 GMT



In order to clean things up, you can do something like this:

1 –  backup your named folder : cd /var;tar czf named.tgz named

2 – cd /var/named

perl -i.bak -ne ‘next if (/^; .+ ; Previous value removed by cPanel transfer auto-merge on/); print;’ /var/named/*.db

/scripts/restartsrv_named

/scripts/restartsrv_named

Friday, September 19, 2014

How to redirect webmail.domain.com to domain.com/webmail?

Here is the steps:-

Make changes to zone db ( Ie /var/named/domain.com.db)
create a subdomain webmail
entry wil be like this

    ==========================
    domain.com. IN A 64.20.54.242
    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 67.20.54.242
    cpanel IN A 67.20.54.242
    whm IN A 67.20.54.242
    webmail IN A 67.20.54.242
    webdisk IN A 67.20.54.242
    ======================

mod_security: Access denied eror code 403

You may get the following error in Apache logs:-

===================================================
mod_security: Access denied with code 403. Error reading request body, error code 70007:

The timeout specified has expired
===================================================
Fix:-

1. Open the Apache configuration file

root@server1 [~]#vi /usr/local/apache/conf/httpd.conf

2. Change the  Timeout value to 300

3. Restart Apache service.

root@server1 [~]# /etc/init.d/httpd restart

Issue will be fixed.

Different ports used on cPanel server

Here is the list of different ports used on cPanel server:-

20 –> FTP (Inbound/Outbound,TCP/UDP)
21 –> FTP (Inbound/Outbound,TCP/UDP)
22 –>SSH (Inbound,TCP)
25 –>SMTP (Inbound/Outbound,TCP)
26 –>SMTP (Inbound/Outbound,TCP)
37 –>RDATE (Outbound,TCP)
43 –>WHOIS(Outbound,TCP)
53 –>DNS (Inbound/Outbound,TCP/UDP)
80 –>HTTP (Inbound/Outbound,TCP)
110 –> POP3(Inbound,TCP)
143 –>IMAP4(Inbound,TCP)
443 –>HTTPS(Inbound,TCP)
465 –>SMTP (TLS/SSL)(Inbound/Outbound,TCP/UDP)
873 –> RSYNC(Outbound,TCP/UDP)
993 –>IMAP4 (SSL)(Inbound,TCP)
995 –>POP3 (SSL)(Inbound,TCP)
2082 –>CPANEL(Inbound,TCP)
2083 –>CPANEL (With SSL)(Inbound,TCP)
2086 –>WHM (Inbound,TCP)
2087 –>WHM (With SSL)(Inbound,TCP)
2089 –>cPanel licence(Outbound,TCP)
2095 –>WEBMAIL(Inbound,TCP)
2096 –>WEBMAIL (With SSL)(Inbound,TCP)
3306 –>MYSQL (Inbound/Outbound,TCP)

Sunday, July 6, 2014

How to install WHMSonic in cpanel

Login to your server root SSH and copy/paste the following command fully and run it.

    cd /root/; rm -f installr.sh; wget http://www.whmsonic.com/setupr/installr.sh; chmod +x installr.sh; ./installr.sh



Sample installation output:

    ***********************************************************************
    * WHMSonic Setup v2.1.11 *
    ***********************************************************************
    WHMSonic installer is now installing the latest version. This may take a few minutes, please wait…
    –2013-11-29 00:55:15– http://www.whmsonic.com/v2/setup/whmsonic.zip
    Resolving www.whmsonic.com… 67.228.53.90
    Connecting to www.whmsonic.com|67.228.53.90|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 10530510 (10M) [application/zip]
    Saving to: `whmsonic.zip’


How to Configure Multiple shared IP’s in WHM

It is not possible to add multiple shared IP’s from WHM but it is possible to do it from SSH.

First of all we need to create a /var/cpanel/mainips/ directory if it is not present.

    mkdir /var/cpanel/mainips/

Then we have to create a file.

    vi /var/cpanel/mainips/root

Add all IP’s into it. save the file and quit.

Thursday, May 1, 2014

Show Scripts Sending email WHM

To trace php script sending email, first you will need root SSH access to server and enable log selector for exim which will help you to generate extra/well defined logs for exim.

To do this Access WHM as root. Access Service Configuration >> Exim Configuration Editor. Click on Advance Editor.

Under exim.conf section you will see #!!# cPanel Exim 4 Config
and you can add following code in the text box.

Saturday, March 29, 2014

How to Setup Reverse DNS in WHM

One of the often overlooked aspects of web hosting is reverse DNS. A website will not connect to users who type in a domain name if the forward DNS does not identify the IP address associated with it, but some domains do not have reverse DNS, despite it being an established Internet standard.

Among other uses, reverse DNS can help security-conscious users and professionals verify that the relationship between a domain and an IP address is valid, which helps prevent spam, phishing, and other nefarious activities.

When you manage your server with WHM from cPanel, it is easy to setup reverse DNS records for your IP addresses. Just follow these steps:

Create a reverse DNS zone file

Friday, March 28, 2014

mod_security best rules

# Deprecated due to security issues so it should be off: http://blog.modsecurity.org/2008/08/transformation.html
SecCacheTransformations Off

# Check Content-Length and reject all non numeric ones
SecRule REQUEST_HEADERS:Content-Length "!^\d+$" "deny,log,auditlog,msg:'Content-Length HTTP header is not numeric', severity:'2',id:'960016'"

# Do not accept GET or HEAD requests with bodies
SecRule REQUEST_METHOD "^(?:GET|HEAD)$" "chain,phase:2,t:none,deny,log,auditlog,status:400,msg:'GET or HEAD requests with bodies', severity:'2',id:'960011',tag:'PROTOCOL_VIOLATION/EVASION'"
SecRule REQUEST_HEADERS:Content-Length "!^0?$" t:none

Cpanel log locations

Apache:
/usr/local/apache/logs/access_log
/usr/local/apache/logs/error_log

MySQL:
/var/lib/mysql/hostname.err

cPanel Installation Logs:
/var/log/cpanel-install-thread0.log

Apache domlogs:
/usr/local/apache/domlogs/example.com

Thursday, January 23, 2014

Disabling an email account

How can a particular email account be ‘disabled’ temporarily. Note that the email account should not be ‘deleted’ ? Is this possible at all via cPanel?

There is no direct functionality in cPanel at the moment for this. This feature might be added at a later stage.
However, you can achieve this functionality by modifying a few entries via SSH.

Comment out the entries related to the particular email account in the following locations:
/home/user/etc/domainname/passwd
/home/user/etc/domainname/shadow
/home/user/etc/domainname/quota

Make sure that you just comment them and NOT delete them as you might need them back later.

Where to check the version of Horde

Where can I check the current version of Horde webmail client running with cPanel ?

If you have ‘root’ SSH access to the server then, simply open the file /var/cpanel/horde/version using your favorite editor and you’ll be able to see the current Horde version.