We do support Round the Clock 24 x 7 x 365 (+91) 883 012 3924
header-image

L3 Web Hosting Blog

cPanel, Plesk, Wordpress Hosting SSD disk

Check out L3WebHosting blog for tips and in-depth articles on web hosting services !!

How to Harden Your cPanel System’s Kernel

Warnings:

  • cPanel-provided hardened kernel update deprecated in cPanel & WHM version 68.
  • The cPanel-provided kernel update will not work for container-based systems like OpenVZ®,Virtuozzo® etc
  • This document only applies to systems installed with CentOS 6 64-bit systems.
  • We strongly suggest that only experienced System Administrators perform this process.

To harden your cPanel system’s kernel, log in to your server as the root user via SSH and perform the following steps:

# cd /etc/yum.repos.d/   
# wget https://securedownloads.cpanel.net/cPkernel/cPkernel.repo
# yum -y update kernel

After you update the kernel, you must restart the system to complete the kernel update. To reboot the server, run the reboot command.

After you reboot the server, verify that the cPanel Hardened Kernel update succeeded with below command :

# uname -r

If the command’s output includes cpanel in the returned value, you successfully updated the kernel.

How to Modify your hosts File


On cPanel server, “mod_userdir” (WHM >> Home >> Security Center >> Apache mod_userdir Tweak) allows you to access website through a temporary URL in the http://IP/~username format.
However, some sites will not work with a temporary URL like wordpress.
For those sites, you can configure your windows computer with the server’s IP address into “hosts” file so you can view website without pointing DNS to your server.

Follow below steps to modify the “hosts” file on a Windows® 8 or Windows® 10 system :

1. On your keyboard, type Win+X on the keyboard, or click the windows icon in the lower-left corner of your desktop interface to to open the Start menu.
2. Enter Notepad in the search text box.
3. Right-click Notepad and select Run as Administrator.
4. From the Notepad , open the following file:
C:\Windows\System32\Drivers\etc\hosts 

5. Add the destination server’s IP address and domain name under the latest entry in the file, for example:

127.0.0.1 localhost localhost.localdomain localhost4 
1.2.3.4 example.com
1.2.3.4 www.example.com
1.2.3.4 blog.example.com

Note:
In this example, 1.2.3.4 represents the destination server’s IP address, and blog.example.com represents the domain name.
6. Save your changes.
7. Reload your web browser for the changes to take effect.

To modify the “hosts" file on a Windows® 7 or Windows Vista® system, perform the following steps:

  1. Click Start.
  2. Enter Notepad in the Start menu search text box.
  3. Right-click Notepad and select Run as Administrator.
  4. From the Notepad, open the following file: C:\Windows\System32\Drivers\etc\hosts 
  5. Add the destination server’s IP address and domain name under the latest entry in the file, for example:
127.0.0.1 localhost localhost.localdomain localhost4 
1.2.3.4 example.com
1.2.3.4 www.example.com
1.2.3.4 blog.example.com

Note: In this example, 1.2.3.4 represents the destination server’s IP address, and blog.example.com represents the domain name.

6. Save your changes.
7 . Reload your web browser for the changes to take effect.

How to check the resource usage on the server

If there is a high load on your server and you need to find out exact processes & users are consuming your server resources.
In such case, we can use “ps” command.

Here are some useful commands :

# To list top 10 CPU usage processes with user

# ps -e -o pcpu,pid,user,args|sort -k1 -nr|head -10

# Find out top 10 CPU consuming process

# ps -auxf|sort -nr -k3|head -10

# To list top 10 Memory consuming processes with user

# ps -e -o pmem,pid,user,args|sort -k1 -nr|head -10

# Find out the top 10 memory consuming process

# ps -auxf|sort -nr -k4|head -10

# Find out every process running under a user

# ps -U user-name -u user-name u

Or

# ps -e -o pid,user,args|grep $username

How to change default PHP version on cPanel server through command line

In WHM, you can change the default PHP version through Multi-PHP Manager.
However, if you want to change the global default PHP version through command line you can follow below steps :

To display the current default PHP version :

# /usr/local/cpanel/bin/rebuild_phpconf –current

Above command is showing PHP 5.6 as default php version. Now we will change it to PHP 7.0 version with below command

# /usr/local/cpanel/bin/rebuild_phpconf –default=ea-php70

How to disable security questions on cPanel WHM server

cPanel / WHM allows you to setup Security Policies for cPanel/whm login page.

If you have configured Security Policies with security questions and you forgot it’s answers, you will not able to login to cPanel / WHM.

Please perform the following steps to disable security questions via the command line :

 

  1. Use SSH to log in to your server with root user.
  2. Open the /var/cpanel/cpanel.config file in your preferred text editor.
  3. Change the value of the SecurityPolicy::SourceIPCheck option to 0.
  4. Save and exit the file.
  5. Run the /scripts/restartsrv cpanel command to restart cPanel & WHM service.

 

How to optimize Website on cPanel server

cPanel allows you to automatically compress website content when visitors access your website.

 

Your system administrator must enable the mod_deflate Apache module for this interface to appear in cPanel.

 

# Login to cPanel account

# You will get “Optimize Website” option under “Software” on your cPanel page.

# To disable compression of your website’s content, perform the following steps:

  1. Select Disabled.

  2. Click Update Settings.

# To compress all of your website’s content, perform the following steps:

  1. Select Compress All Content.

  2. Click Update Settings.

# To specify a list of types of content to compress, perform the following steps:

  1. Select the Compress the specified MIME types option.

  2. In the MIME Types text box, enter a space-separated list of the types of content that you wish to compress (for example, text/html text/plain text/xml).

  3. Click Update Settings.

 

 

Disable LFD alerts for specific user

By default, LFD sends a lot of alerts for all users/processes/activities.

We can disable LFD alerts for a specific user.

# Login to shell with root user

#  We need to findout the UID (User ID) of that user

# You can check the UID information from /etc/passwd file or from the CLI by using the command “id.

# grep -i nick /etc/passwd
nick:x:754:754:nick:/:/sbin/nologin
# id -u nick
754

# Now open /etc/csf/csf.uidignore file

# Add the UID into  /etc/csf/csf.uidignore file

# Restart CSF and LFD.

csf -r
# /etc/init.d/lfd restart

 

Manage email notifications on cPanel/WHM server

By default, cPanel server generates many notifications.

We can enable / disable those notification emails like Account Creation alert, Account Removal alert, Account Suspensions alert, Account UnSuspensions alert, Account Upgrades/Downgrades alert, Altered RPMs Check alert, AppConfig registration notifications alert, Bandwidth Limits alert, Branding Migration alert, cPanel Backup alert, cPanel Backup Destination Disabled alert, cPanel Configuration Checks alert, cPanel Required Perl Module Auto Installs alert, cPHulkd Notifications alert, Disk Integrity Check alert, Disk Quota Check alert, Kernel Crash Check alert, Recently Uploaded Cgi Script Mail alert, Service interruption (ChkServd) alert etc.

# Log into WHM with root user

# Click on “Server Contacts”
# Click on “Contact Manager” and click on “Notifications” tab
# You will get different options like

# From drop-down list, you need to select Disable, Low, Medium or High.

# Click on “Save” button.

 

Disable AutoSSL email notifications from cPanel

You can enable / disable AutoSSL email notifications from cPanel account.

Here are steps :

# Login to cPanel account

# Click on “Contact Information”

# You will get multiple options.
Select the check box next to each option to enable/disable per your notification preferences.

# Click on “Save” button