10/28/2014

How to keep ssh alive on centos

By default, the SSH servers are set to disconnect clients who has been inactive or idle after a certain period of time. In order to keep the ssh session alive, you may configure the ssh server.

You may change the ClientAliveInterval, TCPKeepAlive and ClientAliveCountMax options in the sshd configuration file. After you config your ssh, please do not forget to restart your ssh server.

#sudo vi /etc/ssh/sshd_config

ClientAliveInterval 100
TCPKeepAlive  yes
ClientAliveCountMax  99999

#sudo  /etc/init.d/sshd restart


10/05/2014

htaccess to redirect to different domain name

In order to implement direction for different domain on htaccess, please use the following configuration.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^aaaa/([0-9]+)\.html$ /index.php?action=A&sid=$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^bbbb/([0-9]+)\.html$ /index.php?action=B&sid=$1 [QSA,L]

9/05/2014

Install PHP55 on centos 6 based remi repos

To install php55 on centos, you need download the remi repository. Please follow the following steps to complete:
1. Download repo
   sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

2. Confirm the remi.repo
    /etc/yum.repos.d/remi.repo

   [remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1

............
3. Install PHP55
   sudo yum install --enablerepo=remi --enablerepo=remi-php55 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug

4. Confirm the version of php
    php --version


  PHP 5.5.16 (cli) (built: Sep  3 2014 20:08:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies 


Note
 Please use the following command if you have installed PHP on your server
   yum --enablerepo=remi-php55,remi update php\*