- February
- 22nd
- 2009
CentOs — how to install mod geo_ip from maxmind
Posted by MaEl in: Bits-and-Bytes Comments (1)
yum install GeoIP
wget http://yum.jardiknas.org/centos/extras/5/i386/mod_geoip-1.1.8-2.el5.i386.rpm
rpm -i mod_geoip-1.1.8-2.el5.i386.rpm
wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -d GeoLiteCity.dat.gz
mkdir /usr/share/GeoIP/
mv GeoLiteCity.dat /usr/share/GeoIP/
nano /etc/httpd/conf.d/mod_geoip.conf
#change GeoIP.dat to GeoLiteCity.dat
- February
- 21st
- 2009
How to protect linux from ddos attack
Posted by MaEl in: Bits-and-Bytes Comments (0)
Some script to automatically blocked an ip with more than 150 connection.
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh
- February
- 21st
- 2009
VPS – how to manual install lxadmin
Posted by MaEl in: Bits-and-Bytes Comments (0)
For those who buy a vps without a control panel, you can install lxadmin.
wget http://download.lxlabs.com/download/lxadmin/production/lxadmin-install-master.sh
sh ./lxadmin-install-master.sh
- February
- 8th
- 2009
PHP – how to remove subdomain from url
Posted by MaEl in: Bits-and-Bytes Comments (3)
$doms = array('http://yahoo.co.uk','http://www.yahoo.co.uk','http://www.yahoo.com','http://yahoo.com','http://www.mail.yahoo.com','http://www.mail.yahoo.co.uk');
foreach ($doms as $dom) {
$matches = explode('//',$dom);
$matches = explode('.',$matches[1]);
//http://yahoo.com
if (count($matches) == 2) {
echo $matches[0] . '.' . $matches[1];
} elseif (count($matches) == 3) {
//http://yahoo.co.uk
if (strlen($matches[2]) == 2) {
echo $matches[0] . '.' . $matches[1] . '.' . $matches[2];
//http://www.yahoo.com
} else {
echo $matches[1] . '.' . $matches[2];
}
} elseif (count($matches) == 4) {
//http://www.yahoo.co.uk
if (strlen($matches[3]) == 2) {
echo $matches[1] . '.' . $matches[2] . '.' . $matches[3];
//http://www.mail.yahoo.com
} else {
echo $matches[2] . '.' . $matches[3];
}
} elseif (count($matches) == 5) {
//http://www.mail.yahoo.co.uk
if (strlen($matches[3]) == 2) {
echo $matches[2] . '.' . $matches[3] . '.' . $matches[4];
}
}
}
this should output
http://yahoo.co.uk => yahoo.co.uk
http://www.yahoo.co.uk => yahoo.co.uk
http://www.yahoo.com => yahoo.com
http://yahoo.com => yahoo.com
http://www.mail.yahoo.com => yahoo.com
http://www.mail.yahoo.co.uk => yahoo.co.uk
- February
- 6th
- 2009
decryt ssl key
Posted by MaEl in: Bits-and-Bytes Comments (0)
Simple and easy!
openssl rsa -in ssl.key -out ssl.key
I just buy ssl from godady.com only $12.99 per yr
here’s the promo code cjcssl12t2
- February
- 2nd
- 2009
Rewrite www to no-www
Posted by MaEl in: Bits-and-Bytes Comments (0)
Redirection via webserver
Most of popular webserver support redirection. The flow of redirection using this method is
- February
- 1st
- 2009
google bug? False “This site may harm your computer”
Posted by MaEl in: Bits-and-Bytes Comments (0)
