PHP-FPM 기준


#Build Essential 설치

apt-get install build-essential


#PHP 의존성 패키지 설치

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libbz2-dev libjpeg-dev libfreetype6-dev libpng12-dev libxpm-dev libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libt1-dev libgd2-xpm-dev libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev libdb5.3-dev


#PHP 소스 다운로드

wget -O /var/tmp/php-5.3.29.tar.bz2 http://php.net/get/php-5.3.29.tar.bz2/from/this/mirror


#PHP 소스 압축 해제

mkdir -p /opt/build

tar jxf /var/tmp/php-5.3.29.tar.bz2 -C /opt/build

cd /opt/build/php-5.3.29


#PHP 소스 설정

./configure \
--enable-fpm \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf  \
--enable-mbstring \
--enable-soap \
--enable-sockets \
--enable-zip  \
--with-bz2 \
--with-curl \
--with-freetype-dir=/usr \
--with-gd \
--with-gettext \
--with-iconv \
--with-jpeg-dir=/usr/lib \
--with-libxml-dir=/usr/lib \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysql-sock \
--with-mysqli \
--with-openssl \
--with-pdo-mysql \
--with-t1lib=/usr \
--with-zlib \
--prefix=/opt/php-5.3.29 \
--with-config-file-path=/opt/php-5.3.29/etc \
--with-fpm-user=www-data \
--with-fpm-group=www-data


#PHP 컴파일

make

make install


# freetype.h 에러시

mkdir /usr/include/freetype2/freetype

ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h


#PHP-FPM 설정

cp /opt/php-5.3.29/etc/php-fpm.conf.default /opt/php-5.3.29/etc/php-fpm.conf

vi /opt/php-5.3.29/etc/php-fpm.conf


[생략]
pid = run/php-fpm.pid

[생략]

user = www-data
group = www-data

[생략]

;listen = 127.0.0.1:9000
listen = /var/run/php53-fpm.sock;

[생략]

listen.owner = www-data
listen.group = www-data
listen.mode = 0660


#PHP-FPM 실행 스크립트 생성

vi /etc/init.d/php53-fpm


#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-5.3.29-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-5.3.29-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-5.3.29/sbin/php-fpm
php_fpm_CONF=/opt/php-5.3.29/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.3.29/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"

wait_for_pid () {
        try=0
        while test $try -lt 35 ; do
                case "$1" in
                        'created')
                        if [ -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                        'removed')
                        if [ ! -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                esac
                echo -n .
                try=`expr $try + 1`
                sleep 1
        done
}
case "$1" in
        start)
                echo -n "Starting php-fpm "
                $php_fpm_BIN $php_opts
                if [ "$?" != 0 ] ; then
                        echo " failed"
                        exit 1
                fi
                wait_for_pid created $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
        stop)
                echo -n "Gracefully shutting down php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -QUIT `cat $php_fpm_PID`
                wait_for_pid removed $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed. Use force-exit"
                        exit 1
                else
                        echo " done"
                       echo " done"
                fi
        ;;
        force-quit)
                echo -n "Terminating php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -TERM `cat $php_fpm_PID`
                wait_for_pid removed $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
        restart)
                $0 stop
                $0 start
        ;;
        reload)
                echo -n "Reload service php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -USR2 `cat $php_fpm_PID`
                echo " done"
        ;;
        *)
                echo "Usage: $0 {start|stop|force-quit|restart|reload}"
                exit 1
        ;;
esac


#PHP 실행 설정

chmod 755 /etc/init.d/php53-fpm

update-rc.d php53-fpm defaults


#PHP 실행

service php53-fpm start

:

라우터에서 카카오톡을 차단하는 방법에는 크게 도메인 차단, IP 차단이 있습니다.

PC에서는 도메인 차단만으로 접속이 차단되나, 스마트폰에서는 IP까지 차단해야 완벽하게 차단할 수 있습니다.


도메인 *.kakao.com 을 차단하면 됩니다.

IP는 103.246.56.0 - 103.246.57.255

110.76.141.0 - 110.76.143.255 를 차단하면 됩니다.


자세한 카카오톡 IP 대역에 대해서는 Kakao IP.txt 첨부파일을 참고하면 됩니다.

'네트워크' 카테고리의 다른 글

페이스북 네트워크 차단하기  (0) 2015.12.19
:

라우터에서 페이스북을 차단하는 방법에는 크게 도메인 차단, IP 차단이 있습니다.

PC에서는 도메인 차단만으로 접속이 차단되나, 스마트폰에서는 IP까지 차단해야 완벽하게 차단할 수 있습니다.


도메인 *.facebook.com 과 *.fbcdn.net 을 차단하면 됩니다.

IP는 31.13.24.0 - 31.13.31.255

31.13.64.0 - 31.13.127.255

45.64.40.0 - 45.64.43.255

69.63.176.0 - 69.63.191.255

69.171.224.0 - 69.171.255.255

66.220.144.0 - 66.220.159.255

74.119.76.0 - 74.119.79.255

103.4.96.0 - 103.4.99.255

129.134.0.0 - 129.134.255.255

157.240.0.0 - 157.240.255.255

173.252.64.0 - 173.252.127.255

179.60.192.0 - 179.60.195.255

185.60.216.0 - 185.60.219.255

204.15.20.0 - 204.15.23.255 를 차단하면 됩니다.


자세한 페이스북 IP 대역에 대해서는 Facebook IP.txt 첨부파일을 참고하면 됩니다.

'네트워크' 카테고리의 다른 글

카카오톡 네트워크 차단하기  (1) 2015.12.19
: