The mod_security plugin could not connect to the database. Please verify that MySQL is running. Error: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) – Solution

If you’re getting following error while accessing mod_sec from WHM, here is the quick solution for this.

The Mod Security plugin could not connect to the database. Please verify that MySQL is running. Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Login to your WHM with root access.
Go to Service Manager from left menu.
See if MySQL Service is enabled and being monitored.
Check the boxes if unchecked.

Now access Mod Security from WHM. It should be working fine now.

Feedback are appreciated 🙂

Get real IP address of visitor for Cloudflare nGinx solution

When you have setup your web sites on cloudflare, every visitor who visits your web site passes through cloudflare network so that his real IP gets changed into cloudflare’s IP address, in short cloudflare acts as proxy server for your web server.
For apache web server, cloudflare has already provided a module which can be installed to get real ip address of visitor.

Here it is :

Well they do not provide any module for nGinx, however it is built in function in nGinx server. You can enable it by adding following below code into your nginx.conf

Follow below steps:

Find nginx.conf file if you do not know the exact location from SSH:

# locate nginx.conf

Add below code in nginx.conf under http section:

real_ip_header     CF-Connecting-IP;

Now save changes and restart your nginx server

service nginx restart

That is all, now you will be able to get real ip address of the visitor.

Comments are welcome.

Disable Sym links on linux WHM/cPanel

Disabling SYM links is not a tough task on WHM/cPanel based servers, however you might not found proper way to do this, here is the quick code for disabling symlinks.

Why disabling symlinks is necessary for non-root users?

Gaining access to other accounts hosted on cPanel/WHM hosting servers is done by symbolic links, hackers usually create symbolic links on an hacked account to gain access to files hosted on other accounts so other accounts can be accessible through those symbolic links. To deal with this issue system administrator should disable symbolic links creation for non-root users.

  • Login to WHM/cPanel server via SSH with root access.
  • execute following commands:
  • $ wget -O
  • $ /scripts/before_apache_make
  • $ chmod 700 /scripts/before_apache_make
  • And then recompile apache by previous saved profile:
  • $ /scripts/easyapache

That is all, you can also check for any symbolic links already created:

  • $ find /home*/*/public_html -type l

    This will output directories and files those are sym linked.

Have fun!

Installing Fantastico on cPanel/WHM

In this post i will describe about the installation of Fantastico on WHM/cPanel powered servers.

What is a Fantastico:

Fantastico is the software/addon which enables you to have one click automatic script installer on linux server. It contains many open source scripts that can be installed with one click from the cPanel/WHM. It is most powerful and best script installer that is being used by most web hosting providers.


To install fantastico on cPanel/WHM you should follow the below instructions:

  • SSH to your server with root privileges.
  • Run the following commands:

# cd /usr/local/cpanel/whostmgr/docroot/cgi

# wget -N

# tar -xzpf fantastico_whm_admin.tgz

# rm -rf fantastico_whm_admin.tgz

  • And you’re done!
  • Now go to your WHM panel and then Add-Ons menu, located at the last of left menu in WHM, Find the link to Fantastico under that menu.
  • Configure it accordingly and you are ready to use it.

Errors and Rectifications:

  • I am having Source Guardian Error, what should i do ?
  • Run the following command from SSH:

# chmod -R 0755 /usr/local/cpanel/3rdparty/etc/ixed

  • My users do not see the link to fantastico, what should i do?
Go to WHM panel and edit the “default” Features list, activate fantastico from there.

Enjoy your web hosting business…

Queries are welcome 🙂