Linux Server - APM - Copyright @ 2012 Good Internet 소 속 IDC실 이 름 정명구매니저 E-mail tech@tongkni.co.kr - 1 -
INDEX 1. 개요 3 2. APM 소스컴파일설치스크립트를이용하여설치하기. 4 3. 웹서버구축하기. 22 3.1 httpd.conf 환경설정. 22 3.2 가상호스트설정. 25 4. 활용하기. 30 4.1 phpmyadmin 설치하기.. 30 4.2 Log Rotate 설정하기. 35 4.3 SSL 서버설치하기. 37-2 -
1. 개요. - APM이란 Apache( 웹서버 )+Php( 웹프로그래밍언어프로그램 )+Mysql( 데이터베이스서버 ) 의앞글자를따서만들어진약어로, 웹서비스를용도로서버를운영하기위해설치하는서비스입니다. - Apache 는리눅스에서사용하는가장안정적이고유명한소프트웨어입니다. 보통 PHP 언어와 Mysql DB 와연동하여운영하며, 각각제작한곳이다르기때문에소프트웨어가잘연동되도록 설치해야합니다. - APM 설치방법에는 RPM 설치, 소스컴파일설치방식이있습니다. 소스컴파일방식은 RPM 설치방식에비해설정파일이나실행파일위치지정및설치옵션을부여하기가용이합니다. 따라서본매뉴얼에서는소스컴파일방식으로진행하며, 통큰아이에서자체제작한자동설치스크립트 (CentOS 6.2에최적화 ) 를사용합니다. - 아래는 APM을이용한웹서버구축절차입니다. 1 APM 소스설치스크립트를이용하여설치. 2 설치및연동이정상적으로되었는지확인. 3 Apache 설정. - Apache의주설정파일인 httpd.conf 파일의내용은크게 3개의 section으로분류됩니다. 1 Global Environment : 아파치웹서버의전반적인환경설정파트입니다. 서버구동방식, 아파치서버의홈디렉토리경로, 웹서버에접근가능한클라이언트허용개수등의데몬관련설정을담당합니다. 2 Main Server configuration : 아파치웹서버의메인웹사이트가사용할값들을설정하는파트입니다. 웹서버의기본포트, 메인웹사이트의웹문서경로, 기본페이지파일지정및순서등의설정을담당합니다. 3 Virtual Hosts : 한시스템에서여러개의웹사이트를운영하고자할때설정하는파트입니다. 각가상호스트별로홈디렉토리, 도메인이름, 로그파일경로등을지정할수있습니다. - 본매뉴얼은 WEB 서비스를하기위한 APM 설치및구축방법에대해작성되었습니다. - 3 -
2. APM 소스컴파일설치스크립트를사용하여설치하기. 1 지금부터통큰아이에서자체제작한자동설치스크립트를이용하여 APM을설치합니다. 아래는자동설치스크립트로설치되는소프트웨어목록입니다. OS 설치시기본적인구성요소가설치되어있지않거나각스크립트에맞지않는버전의 OS 일경우설치가실패할수있습니다. yum update - 커널, 라이브러리및패키지업데이트. 서버시간을 time.bora.ne(ntp 서버 ) 와동기화 Apache 2.2.22 버전설치. Mysql 5.0.37 버전설치. ( 언어셋 =Euckr) PHP 5.2.10 버전설치. Zend Optimizer 3.3.9 설치. 방화벽 (iptables) 에 21번, 25번, 80번, 3306번, 53번포트허용정책추가. MOD_URL 설치. 2 root 홈디렉토리에 APM 설치스크립트파일을생성합니다. vi /root/test.sh 3 편집기에서 i 를눌러입력모드로전환하고통큰아이에서자체제작한아래스크립트를붙 - 4 -
여넣은후 :wq! 를입력하여저장합니다. ( 붙여넣기 : 입력모드전환후 Shift + Insert) 본매뉴얼은 CentOS 6.x 커널기반으로작성이되었으며, CentOS 5.x 커널용스크립트는각프로그램의버전이나명칭이다를수있으니본매뉴얼을적절히참고하여진행하시기바랍 니다. CentOS 6.x 버전 #!/bin/bash yum -y install wget make gcc* yum -y update clear echo "####################################################" echo "######### 설치를시작합니다. ###########" echo "######### 설치를시작합니다. ###########" > /root/autoscripterr.log # 작동중인프로세스중지 ##################################################################### killall httpd killall mysqld ##################################################################### # 시간동기화 /usr/bin/rdate -s time.bora.net && /sbin/clock -w 2>> /root/autoscripterr.log echo "##### 시간동기화완료 ##################" echo "##### 시간동기화완료 ##################" >> /root/autoscripterr.log cd /usr/local/src echo "######### httpd 다운시작. ###########" echo "######### httpd 다운시작. ###########" >> /root/autoscripterr.log wget http://downloads.sourceforge.net/project/apachehttp.mirror/httpd-2.2.22.tar.gz?r=http%3a%2f%2fen.sourceforge.jp %2Fprojects%2Fsfnet_apachehttp.mirror%2Fdownloads%2Fhttpd-2.2.22.tar.gz%2F&ts=1361416795&use_mirror=jaist echo "######### httpd 다운완료. ###########" echo "######### httpd 다운완료. ###########" >> /root/autoscripterr.log echo "######### MYsql 다운시작. ###########" echo "######### MYsql 다운시작. ###########" >> /root/autoscripterr.log wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.32.tar.gz echo "######### MYsql 다운완료. ###########" echo "######### MYsql 다운완료. ###########" >> /root/autoscripterr.log echo "######### PHP 다운시작. ###########" echo "######### PHP 다운시작. ###########" >> /root/autoscripterr.log wget http://museum.php.net/php5/php-5.2.17.tar.bz2 echo "######### PHP 다운완료. ###########" echo "######### PHP 다운완료. ###########" >> /root/autoscripterr.log wget http://downloads.zend.com/optimizer/3.3.9/zendoptimizer-3.3.9-linux-glibc23-i386.tar.gz echo "######### ZendOptimizer 다운완료. ###########" echo "######### ZendOptimizer 다운완료. ###########" >> /root/autoscripterr.log wget ftp://ftp.kr.freebsd.org/pub/freebsd/ports/distfiles/libmcrypt-2.5.8.tar.gz wget ftp://ftp.superuser.co.kr/etc/libpng-1.2.5.tar.gz tar zxvf libpng* 2>> /root/autoscripterr.log - 5 -
tar zxvf /usr/local/src/httpd-2.2.22.tar.gz 2>> /root/autoscripterr.log tar zxvf /usr/local/src/mysql-5.1.32.tar.gz 2>> /root/autoscripterr.log tar zxvf php-5.2.17.tar.gz 2>> /root/autoscripterr.log tar zxvf libmcrypt-2.5.8.tar.gz 2>> /root/autoscripterr.log tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz 2>> /root/autoscripterr.log cp -a libmcrypt-2.5.8 /usr/local cd /usr/local/libmcrypt-2.5.8./configure --prefix=/usr/local/ 2>> /root/autoscripterr.log make make check make install 2>> /root/autoscripterr.log cd /usr/local/src/libpng* cp scripts/makefile.linux makefile make test make install 2>> /root/autoscripterr.log echo "######### APM 압축해제완료. ###########" echo "######### APM 압축해제완료. ###########" >> /root/autoscripterr.log cd /usr/local/src/mysql-5.1.32./configure --prefix=/usr/local/mysql --with-charset=euckr --with-extra-charsets=all --with-readline --localstatedir=/usr/local/mysql/data --enable-thread-safe-client 2>> /root/autoscripterr.log echo "######### mysql configure 완료. ###########" echo "######### mysql configure 완료. ###########" >> /root/autoscripterr.log make&& 2>> /root/autoscripterr.log make check make install&& 2>> /root/autoscripterr.log echo "######### mysql make 및 make install 완료. ###########" echo "######### mysql make 및 make install 완료. ###########" >> /root/autoscripterr.log adduser mysql -d/usr/local/mysql -M -s/sbin/nologin -r 2>> /root/autoscripterr.log scripts/mysql_install_db 2>> /root/autoscripterr.log chown mysql.mysql /usr/local/mysql -R 2>> /root/autoscripterr.log ln -s /usr/local/mysql/include/mysql /usr/local/include/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/lib/mysql /usr/local/lib/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/bin/mysql /sbin/mysql 2>> /root/autoscripterr.log cp support-files/mysql.server /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log service mysqld start ln -sf /var/lib/mysql/mysql.sock /tmp/mysql.sock ln -s /var/lib/mysql/data /usr/local/mysql/data - 6 -
chkconfig --add mysqld 2>> /root/autoscripterr.log yum -y install vsftpd cp /etc/vsftpd/vsftpd.conf /etc service vsftpd restart 2>> /root/autoscripterr.log echo "######### VSFTPD 재시작. ###########" echo "######### VSFTPD 재시작. ###########" >> /root/autoscripterr.log service mysqld restart 2>> /root/autoscripterr.log echo "######### MY-SQLD 재시작. ###########" echo "######### MY-SQLD 재시작. ###########" >> /root/autoscripterr.log chkconfig --add vsftpd cd /usr/local/src/httpd-2.2.22 cat /usr/local/src/httpd-2.2.22/server/mpm/prefork/prefork.c sed 's\#define DEFAULT_SERVER_LIMIT 256\#define DEFAULT_SERVER_LIMIT 1280\g' > /usr/local/src/httpd-2.2.22/server/mpm/prefork/preforkt.c mv -f /usr/local/src/httpd-2.2.22/server/mpm/prefork/preforkt.c /usr/local/src/httpd-2.2.22/server/mpm/prefork/prefork.c 2>> /root/autoscripterr.log cat /usr/local/src/httpd-2.2.22/server/mpm/worker/worker.c sed 's\#define DEFAULT_SERVER_LIMIT 16\#define DEFAULT_SERVER_LIMIT 1280\g' > /usr/local/src/httpd-2.2.22/server/mpm/worker/workert.c mv -f /usr/local/src/httpd-2.2.22/server/mpm/worker/workert.c /usr/local/src/httpd-2.2.22/server/mpm/worker/worker.c 2>> /root/autoscripterr.log yum -y install openssl* 2>> /root/autoscripterr.log cd /usr/local/src/httpd-2.2.22./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr --enable-modsecurity --enable-rewrite 2>> /root/autoscripterr.log echo "######### apache configure 완료. ###########" echo "######### apache configure 완료. ###########" >> /root/autoscripterr.log make&& make install&& 2>> /root/autoscripterr.log echo "######### apache make 및 make install 완료. ###########" echo "######### apache make 및 make install 완료. ###########" >> /root/autoscripterr.log cp build/rpm/httpd.init /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cd /etc/rc.d/init.d 2>> /root/autoscripterr.log chkconfig --add httpd 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log chkconfig --add httpd 2>> /root/autoscripterr.log chkconfig --add mysqld 2>> /root/autoscripterr.log - 7 -
chkconfig --level 3 httpd on 2>> /root/autoscripterr.log chkconfig --level 3 mysqld on 2>> /root/autoscripterr.log service iptables stop cat /etc/sysconfig/iptables sed 's\-a INPUT -j REJECT --reject-with icmp-host-prohibited\-a INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT\g' > /etc/sysconfig/iptables_t mv -f /etc/sysconfig/iptables_t /etc/sysconfig/iptables 2>> /root/autoscripterr.log cat /etc/sysconfig/iptables sed 's\commit\-a INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT\g' > /etc/sysconfig/iptables_t mv -f /etc/sysconfig/iptables_t /etc/sysconfig/iptables 2>> /root/autoscripterr.log echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A INPUT -j REJECT --reject-with icmp-host-prohibited" >> /etc/sysconfig/iptables echo "COMMIT" >> /etc/sysconfig/iptables echo "######### iptables 수정완료. ###########" echo "######### iptables 수정완료. ###########" >> /root/autoscripterr.log service iptables restart 2>> /root/autoscripterr.log echo "######### iptables 재시작완료. ###########" echo "######### iptables 재시작완료. ###########" >> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\httpd=${httpd-/usr/sbin/httpd}\httpd=/usr/local/apache2/bin/httpd\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\conffile=/etc/httpd/conf/httpd.conf\conffile=/usr/local/apache2/conf/httpd.conf\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\pidfile=${pidfile-/var/log/httpd/${prog}.pid}\pidfile=/usr/local/apache2/logs/httpd.pid\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#servername www.example.com:80\servername 127.0.1.1\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\deny from all\allow from all\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log echo "######### /etc/rc.d/init.d/httpd 수정완료. ###########" echo "######### /etc/rc.d/init.d/httpd 수정완료. ###########" >> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log service httpd start 2>> /root/autoscripterr.log echo "######### httpd 재시작완료. ###########" echo "######### httpd 재시작완료. ###########" >> /root/autoscripterr.log cd /usr/local/src/php-5.2.17 2>> /root/autoscripterr.log - 8 -
echo "/lib" >> /etc/ld.so.confphp-5.2.10 echo "/usr/lib" >> /etc/ld.so.conf echo "/usr/local/lib" >> /etc/ld.so.conf echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf && ldconfig ldconfig 2>> /root/autoscripterr.log yum -y install libc-client-devel mhash mhash-devel libmcrypt libmcrypt-devel 2>> /root/autoscripterr.log yum -y install openssl openssl-devel mhash mhash-devel libtool libtool-ltdl libtool-ltdl-devel imap-devel imap zlib-devel zlib freetype-devel freetype libpng-devel libpng libjpeg-devel libjpeg libtiff-devel libtiff gd-devel* gd pcre-devel pcre libxml-devel libxml libxml2-devel libxml2 gdbm-devel gdbm ncurses-devel ncurses curl-devel curl expat-devel expat bzip2-devel bzip2-libs bzip2 uw-imap-devel libc-client libc-client-devel libmcrypt libmcrypt-devel gmp* yum -y install lemon cd /usr/local/src wget http://kent.dl.sourceforge.net/sourceforge/re2c/re2c-0.13.4.tar.gz tar zxvf re2c-0.13.4.tar.gz cd re2c-0.13.4./configure make && make install cd /usr/local/src wget http://dfn.dl.sourceforge.net/sourceforge/flex/flex-2.5.4a.tar.gz tar zxvf flex-2.5.4a.tar.gz 2>> /root/autoscripterr.log cd /usr/local/src/flex-2.5.4./configure --prefix=/usr/local 2>> /root/autoscripterr.log make && make install 2>> /root/autoscripterr.log cd /usr/local/src/php-5.2.17./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --enable-calendar --enable-shmop --enable-ftp --enable-sockets --enable-magic-quotes --disablecgi --with-gd --with-png-dir=/usr/lib --with-zlib-dir --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib --with-iconv --enablembstring --with-mcrypt=/usr/local 2>> /root/autoscripterr.log echo "######### PHP configure 완료. ###########" echo "######### PHP configure 완료. ###########" >> /root/autoscripterr.log make && 2>> /root/autoscripterr.log make install && 2>> /root/autoscripterr.log echo "######### PHP make 및 make install 완료. ###########" echo "######### PHP make 및 make install 완료. ###########" >> /root/autoscripterr.log cp php.ini-dist /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log echo "<?php" > /usr/local/apache2/htdocs/index.php echo "echo phpinfo();" >> /usr/local/apache2/htdocs/index.php echo "?>" >> /usr/local/apache2/htdocs/index.php cat /usr/local/apache2/conf/php.ini sed 's\register_globals = Off\register_globals = On\g' > /usr/local/apache2/conf/php_t.ini mv -f /usr/local/apache2/conf/php_t.ini /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/php.ini sed 's\magic_quotes_gpc = Off\magic_quotes_gpc = On\g' > /usr/local/apache2/conf/php_t.ini - 9 -
mv -f /usr/local/apache2/conf/php_t.ini /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#addencoding x-compress.z\addtype application/x-httpd-php.php.htm.html\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#addencoding x-gzip.gz.tgz\addtype application/x-httpd-php-source.phps\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log service httpd restart 2>> /root/autoscripterr.log echo "######### MOD_URL 설치시작 ###########" echo "######### MOD_URL 설치시작 ###########" >> /root/autoscripterr.log cd /usr/local/src/ wget http://kldp.net/frs/download.php/4101/mod_url-apache2-1.8.tar.bz2 tar xvfj mod_url-apache2-1.8.tar.bz2 cd mod_url-apache2 /usr/local/apache2/bin/apxs -aic mod_url.c echo "<IfModule mod_url.c>" >> /usr/local/apache2/conf/httpd.conf echo "CheckURL On" >> /usr/local/apache2/conf/httpd.conf echo "</IfModule>" >> /usr/local/apache2/conf/httpd.conf echo "######### Zend Optimizer 설치시작 ###########" echo "######### Zend Optimizer 설치시작 ###########" >> /root/autoscripterr.log cd /usr/local/src cd /usr/local/src/zendoptimizer-3.3.9-linux-glibc23-i386/data cp 5_2_x_comp/ZendOptimizer.so /usr/local/php/lib/ cat >> /usr/local/apache2/conf/php.ini << DOCUMENT [Zend] zend_optimizer.version=3.3.9 zend_extension=/usr/local/php/lib/zendoptimizer.so DOCUMENT service httpd restart 2>> /root/autoscripterr.log echo "######### 모든설치완료. 수고하셨습니다. ###########" echo "######### 모든설치완료. 수고하셨습니다. ###########" >> /root/autoscripterr.log CentOS 5.x 버전 yum -y update clear echo "####################################################" echo "######### 설치를시작합니다. ###########" - 10 -
echo "######### 설치를시작합니다. ###########" > /root/autoscripterr.log # 작동중인프로세스중지 ##################################################################################### killall httpd killall mysqld ##################################################################################### # 시간동기화 /usr/bin/rdate -s time.bora.net && /sbin/clock -w 2>> /root/autoscripterr.log echo "##### 시간동기화완료 ##################" echo "##### 시간동기화완료 ##################" >> /root/autoscripterr.log yum -y install ncurses-devel* 2>> /root/autoscripterr.log #yum -y install mod_ssl mod_dav_svn cd /usr/local/src echo "######### httpd 다운시작. ###########" echo "######### httpd 다운시작. ###########" >> /root/autoscripterr.log wget http://ftp.superuser.co.kr/pub/apache/httpd-2.2.2.tar.gz echo "######### httpd 다운완료. ###########" echo "######### httpd 다운완료. ###########" >> /root/autoscripterr.log echo "######### MYsql 다운시작. ###########" echo "######### MYsql 다운시작. ###########" >> /root/autoscripterr.log wget http://ftp.superuser.co.kr/pub/mysql/mysql-5.0.37.tar.gz echo "######### MYsql 다운완료. ###########" echo "######### MYsql 다운완료. ###########" >> /root/autoscripterr.log echo "######### PHP 다운시작. ###########" echo "######### PHP 다운시작. ###########" >> /root/autoscripterr.log wget http://ftp.superuser.co.kr/pub/php/php-5.2.0.tar.gz echo "######### PHP 다운완료. ###########" echo "######### PHP 다운완료. ###########" >> /root/autoscripterr.log wget http://downloads.zend.com/optimizer/3.3.9/zendoptimizer-3.3.9-linux-glibc23-i386.tar.gz echo "######### ZendOptimizer 다운완료. ###########" echo "######### ZendOptimizer 다운완료. ###########" >> /root/autoscripterr.log wget ftp://ftp.kr.freebsd.org/pub/freebsd/ports/distfiles/libmcrypt-2.5.8.tar.gz wget ftp://ftp.superuser.co.kr/etc/libpng-1.2.5.tar.gz tar xvfz libpng* tar xfz /usr/local/src/httpd-2.2.2.tar.gz 2>> /root/autoscripterr.log tar xfz /usr/local/src/mysql-5.0.37.tar.gz 2>> /root/autoscripterr.log tar xfz /usr/local/src/php-5.2.0.tar.gz 2>> /root/autoscripterr.log tar xfz /usr/local/src/zendoptimizer-3.3.9-linux-glibc23-i386.tar.gz 2>> /root/autoscripterr.log tar xvfz libmcrypt-2.5.8.tar.gz cp -a libmcrypt-2.5.8 /usr/local cd /usr/local/libmcrypt-2.5.8./configure --prefix=/usr/local/ - 11 -
make make check make install yum -y libtool-ltdl-devel cd libpng* cp scripts/makefile.linux makefile make test make install echo "######### APM 압축해제완료. ###########" echo "######### APM 압축해제완료. ###########" >> /root/autoscripterr.log cd /usr/local/src/mysql-5.0.37./configure --prefix=/usr/local/mysql --with-charset=euckr --with-extra-charsets=all --with-readline --localstatedir=/usr/local/mysql/data 2>> /root/autoscripterr.log echo "######### mysql configure 완료. ###########" echo "######### mysql configure 완료. ###########" >> /root/autoscripterr.log make&& 2>> /root/autoscripterr.log make check make install&& 2>> /root/autoscripterr.log echo "######### mysql make 및 make install 완료. ###########" echo "######### mysql make 및 make install 완료. ###########" >> /root/autoscripterr.log adduser mysql -d/usr/local/mysql -M -s/sbin/nologin -r 2>> /root/autoscripterr.log scripts/mysql_install_db 2>> /root/autoscripterr.log chown mysql.mysql /usr/local/mysql -R 2>> /root/autoscripterr.log ln -s /usr/local/mysql/include/mysql /usr/local/include/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/lib/mysql /usr/local/lib/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql 2>> /root/autoscripterr.log ln -s /usr/local/mysql/bin/mysql /sbin/mysql 2>> /root/autoscripterr.log cp support-files/mysql.server /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log service mysqld start ln -sf /var/lib/mysql/mysql.sock /tmp/mysql.sock ln -s /var/lib/mysql/data /usr/local/mysql/data chkconfig --add mysqld 2>> /root/autoscripterr.log yum -y install vsftpd cp /etc/vsftpd/vsftpd.conf /etc service vsftpd restart 2>> /root/autoscripterr.log echo "######### VSFTPD 재시작. ###########" echo "######### VSFTPD 재시작. ###########" >> /root/autoscripterr.log service mysqld restart 2>> /root/autoscripterr.log echo "######### MY-SQLD 재시작. ###########" echo "######### MY-SQLD 재시작. ###########" >> /root/autoscripterr.log - 12 -
chkconfig --add vsftpd chkconfig --level 3 vsftpd on cd /usr/local/src/httpd-2.2.2 cat /usr/local/src/httpd-2.2.2/server/mpm/prefork/prefork.c sed 's\#define DEFAULT_SERVER_LIMIT 256\#define DEFAULT_SERVER_LIMIT 1280\g' > /usr/local/src/httpd-2.2.2/server/mpm/prefork/preforkt.c mv -f /usr/local/src/httpd-2.2.2/server/mpm/prefork/preforkt.c /usr/local/src/httpd-2.2.2/server/mpm/prefork/prefork.c 2>> /root/autoscripterr.log cat /usr/local/src/httpd-2.2.2/server/mpm/worker/worker.c sed 's\#define DEFAULT_SERVER_LIMIT 16\#define DEFAULT_SERVER_LIMIT 1280\g' > /usr/local/src/httpd-2.2.2/server/mpm/worker/workert.c mv -f /usr/local/src/httpd-2.2.2/server/mpm/worker/workert.c /usr/local/src/httpd-2.2.2/server/mpm/worker/worker.c 2>> /root/autoscripterr.log yum -y install openssl* 2>> /root/autoscripterr.log./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr --enable-modsecurity --enable-rewrite 2>> /root/autoscripterr.log echo "######### apache configure 완료. ###########" echo "######### apache configure 완료. ###########" >> /root/autoscripterr.log make&& make install&& 2>> /root/autoscripterr.log echo "######### apache make 및 make install 완료. ###########" echo "######### apache make 및 make install 완료. ###########" >> /root/autoscripterr.log cp build/rpm/httpd.init /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cd /etc/rc.d/init.d 2>> /root/autoscripterr.log chkconfig --add httpd 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/mysqld 2>> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log chkconfig --add httpd 2>> /root/autoscripterr.log chkconfig --add mysqld 2>> /root/autoscripterr.log chkconfig --level 3 httpd on 2>> /root/autoscripterr.log chkconfig --level 3 mysqld on 2>> /root/autoscripterr.log chkconfig --level 3 vsftpd on 2>> /root/autoscripterr.log service iptables stop cat /etc/sysconfig/iptables sed 's\-a RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited\-a RH-Firewall-1- INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT\g' > /etc/sysconfig/iptables_t mv -f /etc/sysconfig/iptables_t /etc/sysconfig/iptables 2>> /root/autoscripterr.log cat /etc/sysconfig/iptables sed 's\commit\-a RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT\g' > /etc/sysconfig/iptables_t mv -f /etc/sysconfig/iptables_t /etc/sysconfig/iptables 2>> /root/autoscripterr.log echo "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT" >> /etc/sysconfig/iptables - 13 -
echo "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT" >> /etc/sysconfig/iptables echo "-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited" >> /etc/sysconfig/iptables echo "COMMIT" >> /etc/sysconfig/iptables echo "######### iptables 수정완료. ###########" echo "######### iptables 수정완료. ###########" >> /root/autoscripterr.log service iptables restart 2>> /root/autoscripterr.log echo "######### iptables 재시작완료. ###########" echo "######### iptables 재시작완료. ###########" >> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\apachectl=/usr/sbin/apachectl\apachectl=/usr/local/apache2/bin/apachectl\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\httpd=${httpd-/usr/sbin/httpd}\httpd=/usr/local/apache2/bin/httpd\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log cat /etc/rc.d/init.d/httpd sed 's\conffile=/etc/httpd/conf/httpd.conf\conffile=/usr/local/apache2/conf/httpd.conf\g' > /etc/rc.d/init.d/httpd_t mv -f /etc/rc.d/init.d/httpd_t /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log echo "######### /etc/rc.d/init.d/httpd 수정완료. ###########" echo "######### /etc/rc.d/init.d/httpd 수정완료. ###########" >> /root/autoscripterr.log chmod 755 /etc/rc.d/init.d/httpd 2>> /root/autoscripterr.log service httpd start 2>> /root/autoscripterr.log echo "######### httpd 재시작완료. ###########" echo "######### httpd 재시작완료. ###########" >> /root/autoscripterr.log cd /usr/local/src/php-5.2.0 2>> /root/autoscripterr.log echo "/lib" >> /etc/ld.so.conf echo "/usr/lib" >> /etc/ld.so.conf echo "/usr/local/lib" >> /etc/ld.so.conf echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf && ldconfig ldconfig 2>> /root/autoscripterr.log yum -y install gd-devel* 2>> /root/autoscripterr.log yum -y install libc-client-devel mhash mhash-devel libmcrypt libmcrypt-devel 2>> /root/autoscripterr.log cd /usr/local/src/php-5.2.0./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --with-mod-charset --with-xml --with-track-debug --enable-track-vars --enable-calendar --enable-shmop --enable-ftp --enable-sockets --enable-mailparse --enable-magic-quotes --enable-track-vars=yes --withlanguage=korean --enable-module=so --with-charset=euc_kr --enable-cgi --with-gd --with-png-dir=/usr/lib --with-zlib-dir --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib --with-iconv --enable-mbstring --enable-exif --with-openssl -disable-posix --disable-rpath --enable-safe-mode --disable-dmalloc --enable-bcmath --enable-gd-native-ttf --enable-sysvsem --enable- - 14 -
sysvshm --enable-wddx --enable-inline-optimization --enable-mbregex --with-imap=shared --with-imap-ssl=/usr/lib --withkerberos --with-mhash --with-mcrypt=/usr/local/lib --with-curl=/usr/local/lib --with-ttf --with-gmp --with-mhash --with-gettext --with-pear --with-libxml-dir --with-mssql=/usr/local/freetds 2>> /root/autoscripterr.log echo "######### PHP configure 완료. ###########" echo "######### PHP configure 완료. ###########" >> /root/autoscripterr.log make && 2>> /root/autoscripterr.log make install && 2>> /root/autoscripterr.log echo "######### PHP make 및 make install 완료. ###########" echo "######### PHP make 및 make install 완료. ###########" >> /root/autoscripterr.log cp php.ini-dist /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log echo "<?php" > /usr/local/apache2/htdocs/index.php echo "echo phpinfo();" >> /usr/local/apache2/htdocs/index.php echo "?>" >> /usr/local/apache2/htdocs/index.php cat /usr/local/apache2/conf/php.ini sed 's\register_globals = Off\register_globals = On\g' > /usr/local/apache2/conf/php_t.ini mv -f /usr/local/apache2/conf/php_t.ini /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/php.ini sed 's\magic_quotes_gpc = Off\magic_quotes_gpc = On\g' > /usr/local/apache2/conf/php_t.ini mv -f /usr/local/apache2/conf/php_t.ini /usr/local/apache2/conf/php.ini 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#addencoding x-compress.z\addtype application/x-httpd-php.php.htm.html\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#addencoding x-gzip.gz.tgz\addtype application/x-httpd-php-source.phps\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\#servername www.example.com:80\servername 127.0.1.1\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log cat /usr/local/apache2/conf/httpd.conf sed 's\deny from all\allow from all\g' > /usr/local/apache2/conf/httpd_t.conf mv -f /usr/local/apache2/conf/httpd_t.conf /usr/local/apache2/conf/httpd.conf 2>> /root/autoscripterr.log service httpd restart 2>> /root/autoscripterr.log echo "######### MOD_URL 설치시작 ###########" echo "######### MOD_URL 설치시작 ###########" >> /root/autoscripterr.log cd /usr/local/src/ wget http://kldp.net/frs/download.php/4101/mod_url-apache2-1.8.tar.bz2 2>> /root/autoscripterr.log tar xvfj mod_url-apache2-1.8.tar.bz2 2>> /root/autoscripterr.log cd mod_url-apache2 /usr/local/apache2/bin/apxs -aic mod_url.c echo "<IfModule mod_url.c>" >> /usr/local/apache2/conf/httpd.conf echo "CheckURL On" >> /usr/local/apache2/conf/httpd.conf echo "</IfModule>" >> /usr/local/apache2/conf/httpd.conf echo "######### Zend Optimizer 설치시작 ###########" echo "######### Zend Optimizer 설치시작 ###########" >> /root/autoscripterr.log - 15 -
cd /usr/local/src cd /usr/local/src/zendoptimizer-3.3.9-linux-glibc23-i386/data cp 5_2_x_comp/ZendOptimizer.so /usr/local/php/lib/ cat >> /usr/local/apache2/conf/php.ini << DOCUMENT [Zend] zend_optimizer.version=3.3.9 zend_extension=/usr/local/php/lib/zendoptimizer.so DOCUMENT service httpd restart 2>> /root/autoscripterr.log echo "######### 모든설치완료. 수고하셨습니다. ###########" echo "######### 모든설치완료. 수고하셨습니다. ###########" >> /root/autoscripterr.log 4 설치스크립트를실행할수있도록권한을부여합니다. chmod 700 /root/test.sh - 16 -
5 설치스크립트를실행합니다. 자동으로 update 및 APM이설치되며, 설치환경에따라 1~3시간정도소요됩니다. /root/test.sh 6 APM 설치로그파일을확인하여설치가정상적으로완료되었는지확인합니다. cat /root/autoscripterr.log - 17 -
7 인터넷브라우저창에웹서버 IP 를입력하면 It works 라고출력되는지확인하여 Apache 가 정상적으로구동되었는지확인합니다. - 18 -
8 phpinfo 기능을이용하여다른소프트웨어가정상적으로설치및연동되었는지확인하기위해현재웹사이트기본페이지인 /usr/local/apache2/htdocs/index.html을편집합니다. vi /usr/local/apache2/htdocs/index.html i 를눌러편집모드로진입후내용을모두지우고아래내용입력. <? phpinfo()?> <ESC> 를누른후 :wq! 를입력하여저장후종료. 9 다시인터넷브라우저창에서버 IP를입력하면이전과는달리아래화면처럼 php 프로그램의환경설정에관한모든정보를테이블형태로출력됩니다. 여기서각소프트웨어가정상적으로설치및연동되었는지대략적으로확인할수있습니다. 아래페이지가출력된다면 Apache와 PHP가정상적으로연동된것입니다. - 19 -
10 mysql 단어를검색후내용을확인하여연동된것을확인합니다. 11 Zend Optimizer 단어를검색후내용을확인하여연동된것을확인합니다. - 20 -
참고 - phpinfo() 페이지의설정값관련참고사이트. ------------------------------------------------------------------------------------------------------ < 참고 URL> http://pmice.tistory.com/149 http://phpschool.com/gnuboard4/bbs/board.php? bo_table=tipntech&wr_id=1452 http://www.apmsetup.com/php.php?tutid=102&uid=139#139 http://php.net/manual/kr/ini.core.php http://blog.naver.com/autovan74?redirect=log&logno=100021168844 http://blog.missflash.com/561 ------------------------------------------------------------------------------------------------------ < 공식사이트 URL> http://www.php.net/manual/kr/ini.list.php ------------------------------------------------------------------------------------------------------ 3. 웹서버구축하기. 3.1 httpd.conf 환경설정. 1 아파치의주설정파일인 httpd.conf 파일의내용은크게 3 개의 section 으로분류됩니다. 아래 - 21 -
명령어를실행하여 httpd.conf 설정을확인합니다. vim /usr/local/apache2/conf/httpd.conf 2 Global Evnironment 에서따로설정할값은없고아래설정을확인합니다. ServerRoot : 아파치가설치된디렉토리위치. Listen 80 : 아파치가사용할포트. 여러개지정가능. LoadModule : 아파치실행시에필요로하는기능들을가진파일을불러오는기능을수행. User, Group : 아파치데몬은 root권한으로실행하지만자식프로세스들은이곳에서지정한 User와 Group로생성. 3 Main Server Configuration 에서다음설정값을적절히수정합니다. ServerAdmin : 서버관리자의 E-Mail 설정. ( 필요한경우변경.) ServerName : 접속할주서버의이름. 도메인이있다면도메인주소를입력하고없으면 IP 주소를입력. ( 가상호스트를사용하지않을경우사용할도메인주소로설정.) - 22 -
DocumentRoot : 클라이언트에서 ServerName 으로접속했을때보여지는페이지가저 장된디렉토리를지정. ( 가상호스트를사용하지않을경우설정.) <Directory> ~ </Directory> : 지정한디렉토리를어떤방식으로제어할것인지설정. ( 보안상필요한경우설정.) - 23 -
DirectoryIndex : DocumentRoot에서지정한디렉토리에서찾게될문서의순서를지정. ( 가상호스트에도같은설정이적용되므로필히설정 ) Ex) 아래그림처럼두개이상의파일을지정했다면홈페이지를접속했을때 index.html 파일을먼저찾아본후없으면 index.php 파일을참조하여페이지를찾아로딩. ErrorLog : 아파치웹서버의에러관련로그를저장할파일의위치를지정. 아래그림처럼설정한경우 DocumentRoot로설정된디렉토리하위의 logs/error_log로저장. (Virutal Hosts 설정에서각사이트에대한에러로그파일을지정하지않으면이파일에저장 ) 그외자세한설정은아래사이트를참고하시기바랍니다. http://www.linux.co.kr/home/lecture/index.php?cateno=2&secno=13&theno=37&leccode=325 3.2 가상호스트설정. 1 가상호스트설정방식에는 2가지가있습니다. 1. httpd.conf에서직접가상호스트설정. 2. httpd.conf에서 Include conf/extra/httpd-vhosts.conf 을입력하여 httpd-vhosts.conf 파일에서 - 24 -
가상호스트설정을담당하도록설정. 여기서는 httpd.conf 에서직접가상호스트를설정하는방법에대해서알아보겠습니다. 2 httpd.conf 설정을연후마지막줄에아래와같이양식에맞게추가합니다. Ex) www.test.com, test1234.com 이라는도메인 2개를운영하려는경우. vim /usr/local/apache2/conf/httpd.conf NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin Webmaster@test.com DocumentRoot "/home/test.com" ServerName test.com ServerAlias www.test.com m.test.com ErrorLog "logs/test.com-error_log" CustomLog "logs/test.com-access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin Webmaster@test1234.com DocumentRoot "/home/test1234.com" ServerName test1234.com ServerAlias www.test1234.com m.test1234.com ErrorLog "logs/test1234.com-error_log" CustomLog "logs/test1234.com-access_log" common </VirtualHost> ServerAdmin : 해당서버의관리자전자우편 DocumentRoot : 해당서버의홈디렉토리. ServerName : 해당서버의도메인주소. ServerAlias : ServerName으로등록된도메인주소로연결할다른도메인주소. ErrorLog : 해당도메인관련된아파치에러가발생하면저장할에러파일지정. CustomLog : 해당도메인관련된아파치로그를저장할로그파일과포맷을지정. - 25 -
3 :wq! 를입력하여설정을저장한후, 설정을적용하기위해아파치를재시작합니다. service httpd restart 4 DocumentRoot 로지정한각각의폴더에간단한 index.html 을생성합니다. - 26 -
vim /home/test.com/index.html 안녕하세요. www.test.com 입니다. vim /home/test1234.com/index.html 안녕하세요. www.test1234.com 입니다. 5 페이지가정상적으로출력되는지외부에서확인하기위해외부 PC 의 hosts 파일 (DNS 서버보 다먼저도메인주소와 IP 를확인하는파일 ) 을메모장으로열어, 하단에아래그림과같이추가 - 27 -
하고저장합니다. ( 테스트환경 : Windows 기반 PC, 일반적인경로는 C:\windows\system32\etc\hosts) < 웹서버 IP> test.com < 웹서버 IP> www.test.com < 웹서버 IP> m.test.com < 웹서버 IP> test1234.com < 웹서버 IP> www.test1234.com < 웹서버 IP> m.test1234.com 6 hosts 파일을편집한테스트 PC 에서인터넷브라우저창을열고해당웹사이트주소를각각 입력하여정상적으로접속되는지확인합니다. - 28 -
7 정상적으로출력이된다면실제적용할도메인을 httpd.conf 설정에적절히적용시키고, DNS 서버에서해당도메인에대한 IP를웹서버의 IP로변경하시면됩니다. 4. 활용하기. 4.1 phpmyadmin 설치하기. 1 phpmyadmin은 MySQL을웹에서쉽게관리할수있도록 GUI환경을제공해주는툴입니 - 29 -
다. /usr/local/src 에서 wget으로 phpmyadmin 설치파일을다운받습니다. cd /usr/local/src wget http://downloads.sourceforge.net/project/phpmyadmin/phpmyadmin/3.3.8/phpmyadmin- 3.3.8-all-languages.tar.gz 2 다운받은설치파일의압축을풀고폴더의이름을 phpmyadmin 으로변경합니다. tar zxf phpmyadmin-3.3.8-all-languages.tar.gz mv phpmyadmin-3.3.8-all-languages phpmyadmin 3 phpmyadmin을 /home 디렉토리로복사하고, 도메인명뒤에 phpmyadmin을입력하면모두 phpmyadmin 디렉토리를접근할수있도록 httpd.conf에 Alias 설정을추가합니다. 또한 phpmyadmin 디렉토리의 index.php 파일을인식할수있도록설정에 index.php를추가하고설정이적용되도록아파치를재시작합니다. - 30 -
cp /usr/local/src/phpmyadmin /home/ vim /usr/local/apache2/conf/httpd.conf Alias /phpmyadmin "/home/phpmyadmin" Alias /phpmyadmin "/home/phpmyadmin" DirectoryIndex index.html index.php service httpd restart 4 phpmyadmin 폴더로접근후샘플로제공된 config 파일을 config.inc.php파일로이름을변경하고해당설정파일을편집합니다. cd /home/phpmyadmin/ mv config.sample.inc.php config.inc.php vim config.inc.php - 31 -
5 인증방식을 cookie 로이용할경우보안상좋지않으므로 auth_type 부분을 cookie 에서 http 로변경하고 :wq! 를입력하여저장합니다. 6 외부PC에서인터넷브라우저창을열어 http:// 도메인주소 /phpmyadmin 을입력하여 phpmyadmin에접속후팝업된로그인창에 MySQL 계정 ID와패스워드를입력합니다. ( 패스워드가설정이안되어있을경우접속이안되므로패스워드설정후접속.) Ex) www.test.com/phpmyadmin - 32 -
7 서버환경에따라아래화면처럼접속에러가발생할수있는데, DB 호스트주소가틀린경우 이므로 config.inc.php 파일의 host 부분을 localhost -> 127.0.0.1 혹은 localhost -> DB 호스 트주소로수정하면대부분해결됩니다. - 33 -
8 다시한번접속하면정상적으로접속되는것을확인할수있습니다. 4.2 Log Rotate 설정. - 34 -
1 아파치웹서버를운영하다보면접속자가많을경우로그가많이쌓여로그파일의용량이 2GB가되면문제가생길수있습니다. Log Rotate를이용하여일정조건을만족할경우새로운로그파일을생성하여문제를해결하도록설정해야합니다. Log Rotate 설정을담당하는 /etc/logrotate.conf 파일을편집하여아래양식대로추가하고저장합니다. ( 설정값은환경에따라적절히변경하고, 파란색으로표기된주석부분은실제적용시문제가되기때문에삭제하시기바랍니다.) vim /etc/logrotate.conf /usr/local/apache2/logs/access_log { # 로그파일이위치한절대경로 daily # 일단위주기로파일생성 (weekly: 주단위, monthly: 월단위 ) rotate 10 # 생성되는파일총개수. 초과하면오래된파일을삭제 sharedscripts postrotate # endscript 구문전까지작성된명령을 logrotate 후실행. /usr/bin/killall -HUP httpd # 파일생성을위해서비스재시작. endscript } :wq! 2 설정한 Log Rotate 를반복예약작업에등록하기위해 /etc/crontab 을확인합니다. 아래화면 처럼 run-parts 가존재한다면별도의작업이필요없지만없는경우아래화면처럼추가해주 - 35 -
어야합니다. vim /etc/crontab 3 /etc/cron.daily 에 logrotate.conf에설정된내용을실행하는 logrotate 라는스크립트파일이있는지확인합니다. ls -al /etc/cron.daily/ 4 Log Rotate 로설정한주기 (Ex: 하루 ) 가지난후로그파일이제대로생성되었는지확인합니다. ls -al /usr/local/apache2/logs - 36 -
4.3 SSL 보안서버설치하기. 1 Apache에 SSL 인증서를설치하여보안서버를구축할수있습니다. 보안서버란인터넷상에서사용자 PC와웹서버사이에송수신되는개인정보를암호화하여전송하는서버를의미합니다. 2 SSL 인증서발급기관에따라설치방법에대해상이하므로 SSL 보안서버에관련된내용은 아래주소 ( 한국인터넷진흥원 ) 를참고하시기바랍니다. http://secsv.kisa.or.kr/ 감사합니다. - 37 -