Archive

Archive for the ‘Control Panel’ Category

Optimize MySQL & Apache on cPanel/WHM server

January 27th, 2018 No comments

Optimize MySQL & Apache on cPanel/WHM server

On this optimization process, we will go over the Apache core configuration and modules that are part of Apache core. We think that with the correct settings of Apache and MySQL you can get excellent results and the correct level of resource use without installing third-party proxy and cache modules. So let’s start,

 

Apache & PHP

In the first stage we run the Easy Apache and selected the following:

  • Apache Version 2.4+

  • PHP Version 5.6+

  • In step 5 “Exhaustive Options List” select

– Deflate

– Expires

– MPM Worker

After Easy Apache finished go to your WHM » Service Configuration » Apache Configuration » “Global Configuration” and set the values by the level of resources available on your server.

Apache Directive       (From 2GB memory or less and to 12GB+ memory)       

StartServers            4       8       16  
MinSpareServers         4       8       16  
MaxSpareServers         8       16      32  
ServerLimit             128         256         512     
MaxRequestWorkers       150         250         500     
MaxConnectionsPerChild      1000        2500        5000 
Keep-Alive          On      On      On
Keep-Alive Timeout      1       1        1
Max Keep-Alive Requests     30      30      30
Timeout             60      60      60

Now go to WHM » Service Configuration » Apache Configuration » Include Editor » “Pre VirtualHost Include” and allow users minimal cache and data compression to allow the server to work less for the same things by pasting the code below into the text field.

# Cache Control Settings for one hour cache
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=3600, public"
</FilesMatch>

<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=3600, public, must-revalidate"
</FilesMatch>

<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=3600, must-revalidate"
</FilesMatch>

# Mod Deflate performs data compression
<IfModule mod_deflate.c>
<FilesMatch ".(js|css|html|php|xml|jpg|png|gif)$">
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE no-gzip
</FilesMatch>
</IfModule>

Go to WHM » Service Configuration » “PHP Configuration Editor” and set the parameters according to your needs:

– memory_limit

– max_execution_time

– max_input_time

 

MySQL

For MySQL you need to update the configuration file that usually in /etc/my.cnf

Best config base on 2 core & 4GB memory MySQL 5.6 \ MariaDB 10:

[mysqld]
    local-infile = 0
    max_connections = 250
    key_buffer = 64M
    myisam_sort_buffer_size = 64M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    max_heap_table_size = 16M
    table_cache = 5000
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 7000
    connect_timeout = 15
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 2M
    query_cache_size = 32M
    query_cache_type = 1
    tmp_table_size = 16M
    open_files_limit=25280

[mysqld_safe]

[mysqldump]
    quick
    max_allowed_packet = 16M
[myisamchk]
    key_buffer = 64M
    sort_buffer = 64M
    read_buffer = 16M
    write_buffer = 16M
[mysqlhotcopy]
    interactive-timeout

Best config base on 8 core & 16GB+ memory (Shared server) MySQL 5.6 \ MariaDB 10:

[mysqld]
local-infile=0
max_connections = 600
max_user_connections=1000
key_buffer_size = 512M
myisam_sort_buffer_size = 64M
read_buffer_size = 1M
table_open_cache = 5000
thread_cache_size = 384
wait_timeout = 20
connect_timeout = 10
tmp_table_size = 256M
max_heap_table_size = 128M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
concurrent_insert = 2
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 5M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65535
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
max_write_lock_count = 8
slow_query_log
log-error
external-locking=FALSE
open_files_limit=50000

[mysqld_safe]

[mysqldump]
quick
max_allowed_packet = 16M

[isamchk]
key_buffer = 384M
sort_buffer = 384M
read_buffer = 256M
write_buffer = 256M

[myisamchk]
key_buffer = 384M
sort_buffer = 384M
read_buffer = 256M
write_buffer = 256M

sort_buffer_size = 1M
join_buffer_size = 1M
thread_stack = 192K

Categories: Control Panel, CPanel / WHM, Tweaks Tags:

How to replace MySQL with MariaDB in cpanel

September 30th, 2014 No comments

Backup existing MySQL data

Make sure to save all existing data just in case there are any issues.

cp -Rf /var/lib/mysql /var/lib/mysql-old
mv /etc/my.cnf /etc/my.cnf-old

Disable the targets so cPanel no longer handles MySQL updates

The following will mark the versions of MySQL we distribute as uninstalled so they are no longer maintained by cPanel/WHM

/scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled

Remove existing MySQL RPM’s so theres a clean slate for MariaDB

The below command will uninstall the MySQL RPM’s!

/scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55

Create a yum repository for MariaDB

vi /etc/yum.repos.d/MariaDB.repo

place the following inside of it depending on the DISTRO (https://downloads.mariadb.org/mariadb/repositories/):

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5.29/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Remove php from the /etc/yum.conf file then run the following commands

yum install MariaDB-server MariaDB-client MariaDB-devel
/etc/init.d/mysql start
mysql_upgrade
/etc/init.d/mysql restart

Add php back to the /etc/yum.conf file to ensure future php updates don’t get clobbered

Rebuild easyapache/php to ensure modules are intact/working

/scripts/easyapache –build

 

install vztop command

April 3rd, 2013 No comments

How to install vztop command in centos

Take vzprocps tools from http://download.openvz.org/contrib/utils/ . These are usual ps and top utilities (named vztop and vzps to not conflict with the standard ones) with an -E option added. You can use -E CTID option to limit the output to the selected CTID (use 0 for the host system), or just -E without an argument to just add CTID column to output.

 

Download the below file using

wget http://download.openvz.org/contrib/utils/vzprocps-2.0.11-6.13.swsoft.i386.rpm
rpm -ivh vzprocps-2.0.11-6.13.swsoft.i386.rpm

Example:

#vzps axf -E 500
#vztop and then press c

 

Categories: Control Panel, SolusVM Tags:

MySQL Governor installation in without control panel server

November 29th, 2012 No comments

MySQL Governor installation in without control panel server

 

Run the below command to install MySQL Governor in plain server or without control panel server.

yum install db-governor –enablerepo=cloudlinux-updates-testing
yum update mysql-server mysql-devel mysql –enablerepo=cloudlinux-updates-testing

Add the below line in my.cnf with root password

 [dbgovernor]

 

Run the below command to start.

service db_governor restart

How to install ioncube on direct admin server

August 5th, 2012 No comments

How to install ioncube on direct admin server

Go to the below path

cd /usr/local/src

Download the tar file using the below link

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Extract that file using the below command.

tar xvf ioncube_loaders_lin_x86-64.tar.gz

Move the file

mv ioncube /usr/local

Open php.ini file.

/usr/local/lib/php.ini

Add the below link into it

zend_extension = /usr/local/ioncube/ioncube_loader_lin_xxxx.so

Restart apache

/etc/init.d/httpd restart

 

Categories: Apache, Control Panel, Installation Tags:

How to reset ssh port through WHM

July 5th, 2012 No comments

How to reset ssh port through WHM

Login to your WHM using 2086

And then browse the below URL:

http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart

It will prompt for server password insert it and it will show that port is reset to default(22)

 

 

 

 

Categories: Control Panel, CPanel / WHM Tags:

Site is working fine with apache but giving 403 error with litespeed

July 5th, 2012 No comments

Site is working fine with apache but giving 403 error with litespeed

=================================
Error 403: Forbidden

You don’t have permissions to access this page. This usually means one of the following:
===================================

Go to the clients account for which you are getting the error message.

Create a .htaccess file and enter the below lines into it.

SecFilterEngine Off

SecFilterScanPOST Off

save and quit

 

Categories: Apache, Control Panel, Uncategorized Tags:

How to reset litespeed admin password

June 30th, 2012 No comments

How to reset litespeed admin password

Go to the below path

/usr/local/lsws/admin/misc

run the below command

sh admpass.sh

It will show below output

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: admin

Please specify the administrator’s password.
This is the password required to login the administration Web interface.

Password:
Retype password:
Administrator’s username/password is updated successfully!

It will ask for the username type (admin) and password you want to set

 

How to install clamd and clamscan on linux server

May 27th, 2012 No comments

How to install clamd and clamscan on linux server

First check the redhat release and os architecture.

cat /etc/redhat-release

architecture check

uname -i

As per you system requirement download the rpm package and install it on the server.

http://dag.wieers.com/rpm/FAQ.php#B

Once done, then run

yum install clamv clamd clamv-devel

 

How to install mod security plugin in WHM

May 27th, 2012 No comments

How to install mod security plugin in WHM

Go to the below path.

cd /usr/local/src

Download the below file.

wget http://www.configserver.com/free/cmc.tgz

Extract that file.

tar -xzf cmc.tgz

Go into that folder.

cd cmc

Run the file using the below command.

sh install.sh

Once done, then access the mod security using WHM.

 

How to uninstall mod security plugin from WHM server

Run the below commands to uninstall mod security plugin from WHM server.

rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmc.cgi

rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmcversion.txt

rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmc/

 

 

Categories: Apache, Control Panel, CPanel / WHM, Security Tags:
%d bloggers like this: