Testing http2

http2 is the latest protocol  everyone is migrating on it due to its reliability and speed. So my client asked me the same to enable it for his server, i had to enable http2 protocol on one of my client’s dedicated server. After enabling it i faced very strange issue that took my couple of hours figuring out the main cause.

I enabled http2 and then tried to access web site with local chrome browser (Version 65.0.3325.181 (Official Build) (64-bit)) it returned http/1.1 all the time in network tab. Then i tried accessing it on my remote desktop server having windows 2012 standard version i saw all the things work fine and in network tab i saw h2 which means it is working.

So i searched on google and came to the conclusion it is either network (ISP), antivirus or firewall which is blocking the access via http2 and reverting back to http/1.1 protocol. Here are 2 URLs to check for http2 support locally and on web server.

Read More

Switching between litespeed and apache from ssh | switch from litespeed

Today i will tell you the ssh command to switch between apache and litespeed web servers. You must have litespeed installed on the server.

This command is useful when you have apache and litespeed installed and your cPanel license is no more operational or expired. You can still swtich between web servers by executing this command via terminal/ssh.


Login to your server with root access via ssh terminal and run followimg ssh command:

To switch from litespeed to apache:

sh /usr/local/lsws/admin/misc/cp_switch_ws.sh apache

To switch from apache to litespeed:

sh /usr/local/lsws/admin/misc/cp_switch_ws.sh lsws

Please note you should write correct path of your litespeed installation directory.

Check active connections to web server – DDOS solution

Here are few commands to check the active connection to apache or to any other web server, you can block IPs having too many connections :

Login to SSH and execute following commands with root access:

1.To see what IPs are connecting to server and how many connections exist from each IP:

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

2.To see how many connections each IP on the server is receiving:

netstat -plan |grep :80 | awk '{print $4}' | cut -d: -f1 | sort | uniq -c | sort -n

3.Get total current active connections to Apache:

netstat -apn | grep :80 | wc -l

Get Apache status update from command line to see which domain is receiving maximum hits (cPanel/WHM server):

lynx http://localhost/whm-server-status

Read More

Enable GeoIP on LiteSpeed web server

This tutorial explains how to install/configure/enable GeoIP location feature on litespeed web server.
Note: You can only use this feature with enterprise license of litespeed web server.

Follow these steps to get it enabled:

First of all download GeoIP location database from official web site (maxmind):

Login to your server via SSH with root access, and execute following commands:
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
cp GeoLiteCity.dat /usr/local/share/GeoIP/

Now you have downloaded GeoIP location database, next is to enable it from LiteSpeed control panel.

Follow these steps:

liteSpeed admin console->Server->General
->Enable IP GeoLocation: Yes

liteSpeed admin console->Server->General
->IP to GeoLocation DB: Add
DB File Path: /usr/local/share/GeoIP/GeoIPCity.dat
DB Cache Type: MemoryCache

Last step is to add a line in .htaccess file of your hosting account directory (public_html in cPanel)

GeoIPEnable On

Well you have configured/enabled GeoIP location system.

Now just make a test on it:
Create a php file on your hosting account, and paste below code in it:

$countryName = $_SERVER["GEOIP_COUNTRY_NAME"];
$countryCode = $_SERVER["GEOIP_COUNTRY_CODE"];

echo $countryName.'<br/ >'.$countryCode;

Now run this file from browser it should return your country name and country code.