2. 리눅스 Server 구축및실무운영 2.4. Apache, Php, Java(Tomcat), Mysql 개발환경웹 Server 이단원에서는리눅스에서다양한웹서비스환경을구축하는법에대해서알아보도록하겠다. 리눅스환경에서구현하는웹서비스구성으로는웹서버프로그램, 웹어플리케이션프로그램, 웹어플리케이션연동 DBMS, 그리고웹어플리케이션에서사용하는라이브러리등으로구성되어집니다. 리눅스환경에서는예로부터 apache, PHP, Mysql 등의구성으로웹서비스환경을구축해왔습니다. 요즘에는 Java 개발자들이많아짐에따라 Tomcat 기반의 Jsp 환경도많이이용되고있습니다. 이런환경의웹서버구축법에대해살펴보도록하겠습니다. 먼저사용해야하는 DBMS를설치해야합니다. 여기서는 Mysql를이용하여구축을해보도록하겠습니다. - 필요프로그램 apache_1.3.33.tar.gz mysql-4.0.24.tar.gz php-4.3.10.tar.bz2 ZendOptimizer-2[1].5.2-Linux_glibc21-i386.tar.gz clibpdf202r1.tar.tar dist.99.linux.tar.z freetype-2.1.3.tar.gz gd-2.0.21.tar.gz imap-2004.tar.z j2sdk-1_4_1_01-fcs-linux-i586.rpm jakarta-tomcat-4.1.30.tar.gz jakarta-tomcat-connectors-4.1.30-src.tar.gz jpegsrc.v6b.tar.gz libpng-1.2.5.tar.gz libungif-4.1.0.tar.gz 1/27 페이지
pdflib-4.0.3.tar.gz tiff-v3.5.7.tar.gz zlib-1.2.1.tar.gz 2.4.1 Mysql DB Server 설치하기 먼저 http://www.mysql.com 사이트에서 mysql source 를다운받는다. 적절한경로에 source 를옮겨놓고압축을푼다. [root@arhfw apmj]# tar xzvf mysql-4.0.24.tar.gz [root@arhfw apmj]# cd mysql-4.0.24 [root@arhfw mysql-4.0.24]#./configure --prefix=/usr/local/mysql \ --localstatedir=/usr/local/mysql/data --with-mysqld-user=mysql --with-charset=euc_kr [root@arhfw mysql-4.0.24]# make && make install 초기 Mysql DB 를생성한다. [root@arhfw mysql-4.0.24]# /usr/local/mysql/bin/mysql_install_db 보안적인문제로 Mysql DB를관리한계정을만든다. 이전에는 root 계정이 mysql DB를관리하였지만, Mysql을이용하여 root 권한이공개되는문제가있어서요즘에는 Mysql을일반계정에서관리하도록하고있다. [root@arhfw mysql-4.0.24]# userdel -r mysql ; groupdel mysql [root@arhfw mysql-4.0.24]# groupadd mysql [root@arhfw mysql-4.0.24]# adduser -g mysql -d /usr/local/mysql/data -s /bin/false mysql [root@arhfw mysql-4.0.24]# chown -R mysql. /usr/local/mysql/data Mysql 최적화설정파일을 /etc/my.cnf 이름으로복사해둔다. [root@arhfw mysql-4.0.24]# cp support-files/my-medium.cnf /etc/my.cnf Mysql initscript 를 /etc/rc.d/init.d 밑에복사해둔다. 2/27 페이지
복사전에한글지원이가능하게수정을한다. [root@arhfw mysql-4.0.24]# cd /usr/local/mysql [root@arhfw mysql]# vi share/mysql/mysql.server -------------------------------------------------------------------------------------- $bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file 위행을찾아서뒤에아래옵션을추가로붙여준다. --language=korean --safe-show-database & -------------------------------------------------------------------------------------- [root@arhfw mysql]# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld 시스템리부팅시자동으로동작하도록설정한다. [root@arhfw mysql]# ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/s90mysqld Mysql Daemon 을시작한다. [root@arhfw mysql]# /etc/rc.d/init.d/mysqld start Mysql 명령을바로사용가능하도록 PATH 설정을하도록한다. [root@arhfw mysql]# vi /etc/profile.d/mysql.sh ------------------------------------------------------------------------------------- MYSQL_HOME=/usr/local/mysql PATH=$PATH:/usr/local/mysql/bin export MYSQL_HOME PATH ------------------------------------------------------------------------------------- Mysql path 환경을적용한다. [root@arhfw mysql]# source /etc/profile.d/mysql.sh mysql root password 를설정한다. 3/27 페이지
초기에는 mysql root 패스워드가 Null 상태로셋팅된다. 보안을위해 Mysql 설치후에반드시 mysql root 암호를변경해주어야한다. [root@arhfw mysql]# mysqladmin -u root password ' 패스워드 ' 이제 Mysql DB 에접속해하여보자 [root@arhfw mysql]# mysql -u root -p mysql ------------------------------------------------------------------------------------ Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.0.24-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> ------------------------------------------------------------------------------------ Mysql 에대한보다자세한관리자기술에대해서는이후 Mysql administration 과정에서다루도록하겠다. 2.4.2 PHP Support Library 설치하기 PHP 웹어플리케이션설치에앞서각시스템 Lib를통해 PHP 의기능을다양하게추가할수있다. PHP 에서기본적으로지원하는함수이외의각 Lib에서도 PHP의다양한함수를지원하고있기때문에 PHP 설치전에 PHP 로프로그래밍을할때필요한추가함수의 Lib를설치를해야한다. 추가 Lib를설치하기앞서앞으로추가하는 Lib 중운영체제에서기본적으로제공하지않는 Lib도있지만 RPM 으로기본제공되어지는 Lib도있을것이다. 최적화된 PHP 환경을만들기위해서는필요한 Lib를모두 Source 설치하는것이좋지만, 운영체제구성요소중에 Source Lib와의존성의문제가발생할수도있으니기존설치된 4/27 페이지
RPM 형식의 Lib 는삭제하지않고추가로 Source Lib 를설치하도록하겠다. rpm 형태로설치된 Lib는 /usr/lib 밑에설치가될것이고, source 로설치된 Lib 는 /usr/local/lib 밑에설치가될것이다. - zlib 설치하기 http://www.gzip.org/zlib/ 에서 zlib 을다운받습니다. [root@arhfw apmj]# tar zxvf zlib-1.2.1.tar.gz [root@arhfw apmj]# cd zlib-1.2.1 [root@arhfw zlib-1.2.1]#./configure -s [root@arhfw zlib-1.2.1]# make [root@arhfw zlib-1.2.1]#./configure && make test && make install [root@arhfw zlib-1.2.1]# cp libz.so* /usr/local/lib [root@arhfw zlib-1.2.1]# cd /usr/local/lib [root@arhfw lib]# rm -rf libz.so [root@arhfw lib]# rm -rf libz.so.1 [root@arhfw lib]# ln -s libz.so.1.2.1 libz.so [root@arhfw lib]# ln -s libz.so.1.2.1 libz.so.1 시스템 LD_PATH 에 /usr/local/lib 를추가하도록한다 [root@arhfw lib]# vi /etc/ld.so.conf -------------------------------------------------------------------------------------- # 맨위에설정을해준다. 순서대로우선순위가정해진다. /usr/local/lib /usr/lib.. -------------------------------------------------------------------------------------- 추가한경로를적용한다. [root@arhfw lib]# ldconfig 5/27 페이지
- tiff 설치하기 [root@arhfw apmj]# tar xzvf tiff-v3.5.7.tar.gz [root@arhfw apmj]# cd tiff-v3.5.7 [root@arhfw apmj]#./configure && make && make install - libpng 설치하기 http://www.libpng.org/pub/png/libpng.html 에서다운받을수있다. [root@arhfw apmj]# cd /usr/local/src/apmj [root@arhfw apmj]# tar zxvf libpng-1.2.5.tar.gz [root@arhfw apmj]# cd libpng-1.2.5 [root@arhfw apmj]# cp scripts/makefile.linux Makefile [root@arhfw apmj]# make test && make install - clibpdf 설치하기 http://www.fastio.com 에서다운받을수있다. [root@arhfw apmj]# mv clibpdf202r1.tar.tar clibpdf202r1.tar.gz [root@arhfw apmj]# tar zxvf clibpdf202r1.tar.gz [root@arhfw apmj]# cd ClibPDF/source [root@arhfw source]# mv Makefile Makefile.orig [root@arhfw source]# cp Makefile.Linux Makefile [root@arhfw source]# make lib && make install - pdflib 설치하기 http://www.pdflib.com 에서다운받을수있다. [root@arhfw apmj]# tar zxvf pdflib-4.0.3.tar.gz [root@arhfw apmj]# cd pdflib-4.0.3 [root@arhfw apmj]#./configure 6/27 페이지
[root@arhfw apmj]# make && make install /etc/ld.so.conf 에 pdflib 경로추가 [root@arhfw apmj]# vi /etc/ld.so.conf ------------------------------------------------------------------------------------. /usr/share/tcl8.3/pdflib ------------------------------------------------------------------------------------ - swf 설치하기 ftp://ftp.sgi.com/sgi/graphics/grafica/flash 에서다운받을수있다. [root@arhfw apmj]# tar zxvf dist.99.linux.tar.z [root@arhfw apmj]# mkdir /usr/local/swf [root@arhfw apmj]# cd dist [root@arhfw dist]# mkdir /usr/local/swf/include [root@arhfw dist]# mkdir /usr/local/swf/lib [root@arhfw dist]# mkdir /usr/local/swf/fonts [root@arhfw dist]# mkdir /usr/local/swf/psfonts [root@arhfw dist]# mkdir /usr/local/swf/bin [root@arhfw dist]# cp swf.h /usr/local/swf/include [root@arhfw dist]# cp libswf.a /usr/local/swf/lib [root@arhfw dist]# cp bin/* /usr/local/swf/bin [root@arhfw dist]# cp fonts/* /usr/local/swf/fonts [root@arhfw dist]# cp psfonts/* /usr/local/swf/psfonts - freetype 설치하기 http://freetype.sourceforge.net 다운받을수있다. [root@arhfw apmj]# tar xzvf freetype-2.1.3.tar.gz [root@arhfw apmj]# cd freetype-2.1.3 [root@arhfw freetype-2.1.3]#./configure && make && make install 7/27 페이지
- Jpeg 설치하기 [root@arhfw apmj]# tar xzvf jpegsrc.v6b.tar.gz [root@arhfw apmj]# cd jpeg-6b [root@arhfw jpeg-6b]#./configure --enable-shared --enable-static [root@arhfw jpeg-6b]# make && make test && make install - libungif 설치하기 ftp://sunsite.unc.edu/pub/linux/libs/graphics 에서다운받을수있다. [root@arhfw apmj]# tar zxvf libungif-4.1.0.tar.gz [root@arhfw apmj]# cd libungif-4.1.0 [root@arhfw libungif-4.1.0]#./configure && make && make install - gd 설치하기 http://www.boutell.com/gd/http/ 에서다운받을수있다. [root@arhfw apmj]# tar zxvf gd-2.0.21.tar.gz [root@arhfw apmj]# cd gd-2.0.21 [root@arhfw gd-2.0.21]#./configure && make && make install - Imap 설치하기 Sendmail 구축편에서 Imap 설치하기문서를참조하세요. 2.4.3 J2SDK,jakarta-tomcat 설치하기 - J2SDK 설치하기 Java 기반의웹어플리케이션인 tomcat 을설치하기위해서는 JAVA SDK 가필요하다. [root@arhfw apmj]# rpm -Uvh j2sdk-1_4_1_01-fcs-linux-i586.rpm 8/27 페이지
[root@arhfw apmj]# cd /usr/java [root@arhfw java]# ln -s j2sdk1.4.1_01/jre jre [root@arhfw java]# ln -s j2sdk1.4.1_01 java 설치된 JAVA 환경설정을한다. [root@arhfw java]# vi /etc/profile ------------------------------------------------------------------------------------.. 제일하단에아래설정을추가한다.. # j2sdk config PATH="$PATH:/usr/java/java/bin" export JAVA_HOME="/usr/java/java" ------------------------------------------------------------------------------------ 설정을적용시킨다. [root@arhfw java]# source /etc/profile 정상적인설치가완료되었는지확인한다. [root@arhfw java]# java -version java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) - apache 1 차 configure [root@arhfw apmj]# tar xzvf apache_1.3.33.tar.gz [root@arhfw apmj]# cd apache_1.3.33 [root@arhfw apache_1.3.33]#./configure --prefix=/usr/local/apache - jakarta-tomcat 설치하기 9/27 페이지
[root@arhfw apmj]# tar xzvf jakarta-tomcat-4.1.30.tar.gz [root@arhfw apmj]# mv jakarta-tomcat-4.1.30 /usr/local/tomcat [root@arhfw apmj]# tar xzvf jakarta-tomcat-connectors-4.1.30-src.tar.gz [root@arhfw apmj]# cd jakarta-tomcat-connectors-4.1.30-src/jk/native [root@arhfw native]#./buildconf.sh [root@arhfw native]#./configure --with-apache=/usr/local/src/apmj/apache_1.3.33 [root@arhfw native]# make && make install jakarta-tomcat apache modules 가정상적으로설치가되었는지확인한다. [root@arhfw native]# ls -al /usr/local/src/apmj/apache_1.3.33/src/modules. drwxr-xr-x 3 root root 4096 Apr 27 18:44 jk. 2.4.4 PHP 설치하기 2.4.2 에서설치한모든 Lib 를 PHP 설치시연동해서포함시킨다. [root@arhfw apmj]# tar xjvf php-4.3.10.tar.bz2 [root@arhfw apmj]# cd php-4.3.10 [root@arhfw php-4.3.10]#./configure --with-apache=/usr/local/src/apmj/apache_1.3.33 \ --with-mysql=/usr/local/mysql \ --with-imap=/usr/local/imap \ --with-jpeg-dir=/usr/local/lib \ --with-png-dir=/usr/local/lib \ --with-gif-dir=/usr/lib \ --with-zlib-dir=/usr/local/lib \ --with-gd=/usr/local/lib \ --with-freetype-dir=/usr/include/freetype2 \ --with-zlib=/usr/local/lib \ --with-tiff-dir=/usr/local/lib \ --with-pdflib \ --with-cpdflib \ 10/27 페이지
--with-gettext \ --with-swf=/usr/local/swf \ --with-xml \ --with-mod_charset \ --with-language=korean \ --with-charset=euc_kr \ --enable-ftp \ --enable-sockets \ --disable-debug \ --enable-system \ --enable-track-vars \ --enable-calendar \ --enable-magic-quotes [root@arhfw php-4.3.10]# make && make install [root@arhfw php-4.3.10]# cp libs/libphp4.a /usr/local/src/apmj/apache_1.3.33/src/modules/php4/ [root@arhfw php-4.3.10]# cp php.ini-dist /usr/local/lib/php.ini 2.4.5 Apache 설치하기 지금까지의과정으로 apache에 tomcat의 jk modules 와 php 의 libphp 모듈이 apache source 에포함되어졌다. 이제최종적으로 apache 와 tomcat 과 php 를연동하여설치하면된다. [root@arhfw php-4.3.10]# cd /usr/local/src/apmj/apache_1.3.33 최종 apache 설치에앞서 apache process 생성갯수를확장하도록한다. /usr/local/src/apmj/apache_1.3.33/src/include/httpd.h 를열어 HARD_SERVER_LIMIT 의 256 부분을적절히증가시켜주면된다. 이설정은실제시스템의보유리소스의정도와커널에서 open process, open file 등의제한이이수치를허용해야한다. 그렇지못한경우는시스템이하드웨어성능이 apache의요구사항을충족시킬능력이없기때문에과부하로시스템을다운될수도있다. 11/27 페이지
-------------------------------------------------------------------------------------- #ifndef HARD_SERVER_LIMIT #ifdef WIN32 #define HARD_SERVER_LIMIT 1024 #elif defined(netware) #define HARD_SERVER_LIMIT 2048 #else #define HARD_SERVER_LIMIT 256 #endif #endif --------------------------------------------------------------------------------------- [root@arhfw apache_1.3.33]#./configure --prefix=/usr/local/apache \ --activate-module=src/modules/php4/libphp4.a \ --activate-module=src/modules/jk/libjk.a \ --enable-module=so \ --enable-rule=shared_core \ --enable-shared=max [root@arhfw apache_1.3.33]# make && make install 이제 apache 기반의 tomcat, php 웹서비스환경구축이완료되었다. 여기에 PHP 가속기인 Zend 를추가적으로설치해보도록하자. 우선기본설치된 apache Daemon 을실행하도록한다. [root@arhfw apache_1.3.33]# vi /usr/local/apache/conf/httpd.conf ------------------------------------------------------------------------------- 간단히 ServerName 의주석을풀고현시스테의도메인이나 IP 를적어준다. 800 줄근처에 AddType allplcation/x-httpd-php 로시작하는부분을찾아서.. AddType application/x-httpd-php.html.php3.php4.inc.phtml.php.ph <= 요렇게 AddType application/x-httpd-php-source.phps 12/27 페이지
바꿉니다. ( 혹은위 2줄을추가합니다. ) ------------------------------------------------------------------------------- [root@arhfw apache_1.3.33]# /usr/local/apache/bin/apachectl restart 2.4.6 Zend PHP 가속기설치하기 [root@arhfw apache_1.3.33]# cd /usr/local/src/apmj [root@arhfw apmj]# tar xzvf ZendOptimizer-2\[1\].5.2-Linux_glibc21-i386.tar.gz [root@arhfw apmj]# cd ZendOptimizer-2.5.2-Linux_glibc21-i386 [root@arhfw ZendOptimizer-2.5.2-Linux_glibc21-i386]#./install 그럼 diglog 형태의설정대화상자가나타난다. 모두 [Next] 로해서넘어간다. 그럼설정이완료된다. 2.4.7 Apache httpd.conf 설정 [root@arhfw apmj]# vi /usr/local/apache/conf/httpd.conf -------------------------------------------------------------------------------- ServerType standalone ServerRoot "/usr/local/apache" #LockFile /usr/local/apache/logs/httpd.lock PidFile /usr/local/apache/logs/httpd.pid ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard #ResourceConfig /usr/local/apache/conf/srm.conf #AccessConfig /usr/local/apache/conf/access.conf Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 MinSpareServers 20 MaxSpareServers 40 13/27 페이지
StartServers 20 MaxClients 256 # apache 웹서버에서수용가능한최대요청수이다. 앞 httpd.h 수정시정의했던수만큼 # 처리가가능하다. MaxRequestsPerChild 0 #Listen 3000 #Listen 12.34.56.78:80 #BindAddress * # Dynamic Shared Object (DSO) Support # LoadModule foo_module libexec/mod_foo.so LoadModule env_module libexec/mod_env.so LoadModule config_log_module libexec/mod_log_config.so LoadModule mime_module libexec/mod_mime.so LoadModule negotiation_module libexec/mod_negotiation.so LoadModule status_module libexec/mod_status.so LoadModule includes_module libexec/mod_include.so LoadModule autoindex_module libexec/mod_autoindex.so LoadModule dir_module libexec/mod_dir.so LoadModule cgi_module libexec/mod_cgi.so LoadModule asis_module libexec/mod_asis.so LoadModule imap_module libexec/mod_imap.so LoadModule action_module libexec/mod_actions.so LoadModule userdir_module libexec/mod_userdir.so LoadModule alias_module libexec/mod_alias.so LoadModule access_module libexec/mod_access.so LoadModule auth_module libexec/mod_auth.so LoadModule setenvif_module libexec/mod_setenvif.so LoadModule php4_module libexec/libphp4.so LoadModule jk_module libexec/libjk.so ClearModuleList 14/27 페이지
AddModule mod_env.c AddModule mod_log_config.c AddModule mod_mime.c AddModule mod_negotiation.c AddModule mod_status.c AddModule mod_include.c AddModule mod_autoindex.c AddModule mod_dir.c AddModule mod_cgi.c AddModule mod_asis.c AddModule mod_imap.c AddModule mod_actions.c AddModule mod_userdir.c AddModule mod_alias.c AddModule mod_access.c AddModule mod_auth.c AddModule mod_so.c AddModule mod_setenvif.c AddModule mod_php4.c AddModule mod_jk.c #ExtendedStatus On Port 80 User nobody Group nobody ServerAdmin root@clunix.org ServerName 192.168.133.254 DocumentRoot "/usr/local/apache/htdocs" <Directory /> Options FollowSymLinks AllowOverride None 15/27 페이지
</Directory> <Directory "/usr/local/apache/htdocs"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <Directory "/home"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Deny from env=go_out Deny from export=go_out </Directory> <IfModule mod_userdir.c> UserDir www </IfModule> #<Directory /home/*/public_html> # AllowOverride FileInfo AuthConfig Limit # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec # <Limit GET POST OPTIONS PROPFIND> # Order allow,deny # Allow from all # </Limit> # <LimitExcept GET POST OPTIONS PROPFIND> # Order deny,allow # Deny from all # </LimitExcept> #</Directory> 16/27 페이지
<IfModule mod_dir.c> DirectoryIndex index.html index.htm index.php index.phtml index.php3 index.jsp </IfModule> AccessFileName.htaccess <Files ~ "^\.ht"> Order allow,deny Deny from all Satisfy All </Files> <Files ~ "^\.ht"> Order allow,deny Deny from all </Files> #CacheNegotiatedDocs UseCanonicalName On <IfModule mod_mime.c> TypesConfig /usr/local/apache/conf/mime.types </IfModule> DefaultType text/plain <IfModule mod_mime_magic.c> MIMEMagicFile /usr/local/apache/conf/magic </IfModule> HostnameLookups Off ErrorLog /usr/local/apache/logs/error_log LogLevel warn LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 17/27 페이지
LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent CustomLog /usr/local/apache/logs/access_log common ServerSignature On # > AddType text/html.ahtml # > EBCDICConvert Off=InOut.ahtml # # EBCDICConvertByType On=InOut text/* message/* multipart/* # EBCDICConvertByType On=In application/x-www-form-urlencoded # EBCDICConvertByType On=InOut application/postscript model/vrml # EBCDICConvertByType Off=InOut */* <IfModule mod_alias.c> Alias /icons/ "/usr/local/apache/icons/" <Directory "/usr/local/apache/icons"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Alias /manual/ "/usr/local/apache/htdocs/manual/" <Directory "/usr/local/apache/htdocs/manual"> Options Indexes FollowSymlinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> 18/27 페이지
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" <Directory "/usr/local/apache/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> </IfModule> <IfModule mod_autoindex.c> IndexOptions FancyIndexing AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/* AddIconByType (SND,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/* AddIcon /icons/binary.gif.bin.exe AddIcon /icons/binhex.gif.hqx AddIcon /icons/tar.gif.tar AddIcon /icons/world2.gif.wrl.wrl.gz.vrml.vrm.iv AddIcon /icons/compressed.gif.z.z.tgz.gz.zip AddIcon /icons/a.gif.ps.ai.eps AddIcon /icons/layout.gif.html.shtml.htm.pdf AddIcon /icons/text.gif.txt AddIcon /icons/c.gif.c AddIcon /icons/p.gif.pl.py AddIcon /icons/f.gif.for AddIcon /icons/dvi.gif.dvi AddIcon /icons/uuencoded.gif.uu 19/27 페이지
AddIcon /icons/script.gif.conf.sh.shar.csh.ksh.tcl AddIcon /icons/tex.gif.tex AddIcon /icons/bomb.gif core AddIcon /icons/back.gif.. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^^BLANKICON^^ DefaultIcon /icons/unknown.gif #AddDescription "GZIP compressed document".gz #AddDescription "tar archive".tar #AddDescription "GZIP compressed tar archive".tgz ReadmeName README HeaderName HEADER IndexIgnore.??* *~ *# HEADER* README* RCS CVS *,v *,t </IfModule> <IfModule mod_mime.c> AddLanguage da.dk AddLanguage nl.nl AddLanguage en.en AddLanguage et.ee AddLanguage fr.fr AddLanguage de.de AddLanguage el.el AddLanguage he.he AddCharset ISO-8859-8.iso8859-8 AddLanguage it.it AddLanguage ja.ja 20/27 페이지
AddCharset ISO-2022-JP.jis AddLanguage kr.kr AddCharset ISO-2022-KR.iso-kr AddLanguage nn.nn AddLanguage no.no AddLanguage pl.po AddCharset ISO-8859-2.iso-pl AddLanguage pt.pt AddLanguage pt-br.pt-br AddLanguage ltz.lu AddLanguage ca.ca AddLanguage es.es AddLanguage sv.sv AddLanguage cs.cz.cs AddLanguage ru.ru AddLanguage zh-tw.zh-tw AddCharset Big5.Big5.big5 AddCharset WINDOWS-1251.cp-1251 AddCharset CP866.cp866 AddCharset ISO-8859-5.iso-ru AddCharset KOI8-R.koi8-r AddCharset UCS-2.ucs2 AddCharset UCS-4.ucs4 AddCharset UTF-8.utf8 <IfModule mod_negotiation.c> LanguagePriority kr en da nl et fr de el it ja no pl pt pt-br ru ltz ca es sv tw </IfModule> AddType application/x-tar.tgz AddEncoding x-compress.z AddEncoding x-gzip.gz.tgz #AddType application/x-compress.z #AddType application/x-gzip.gz.tgz 21/27 페이지
AddType application/x-httpd-php.html.php3.php4.inc.phtml.php.ph.jsp.xtm AddType application/x-httpd-php-source.phps AddHandler cgi-script.cgi #AddType text/html.shtml #AddHandler server-parsed.shtml #AddHandler send-as-is asis #AddHandler imap-file map #AddHandler type-map var </IfModule> #MetaDir.web #MetaSuffix.meta # Customizable error response (Apache style) # these come in three flavors # # 1) plain text #ErrorDocument 500 "The server made a boo boo. # n.b. the single leading (") marks it as text, it does not get output # # 2) local redirects #ErrorDocument 404 /missing.html # to redirect to local URL /missing.html #ErrorDocument 404 /cgi-bin/missing_handler.pl # N.B.: You can redirect to a script or a document using server-side-includes. # # 3) external redirects #ErrorDocument 402 http://www.example.com/subscription_info.html # N.B.: Many of the environment variables associated with the original # request will *not* be available to such a script. 22/27 페이지
# # Customize behaviour based on the browser # <IfModule mod_setenvif.c> BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0 BrowserMatch "JDK/1\.0" force-response-1.0 BrowserMatch "Webzip" go_out BrowserMatch "WebZip" go_out BrowserMatch "Teleport" go_out BrowserMatch "GetRight" go_out BrowserMatch "Wget" go_out </IfModule> #<Location /server-status> # SetHandler server-status # Order deny,allow # Deny from all # Allow from.example.com #</Location> # Allow remote server configuration reports, with the URL of # http://servername/server-info (requires that mod_info.c be loaded). # Change the ".example.com" to match your domain to enable. # #<Location /server-info> # SetHandler server-info # Order deny,allow # Deny from all # Allow from.example.com #</Location> 23/27 페이지
# MOD_JK <IfModule mod_jk.c> JkWorkersFile /usr/local/tomcat/conf/workers.properies JkLogFile /usr/local/tomcat/logs/jk.log JkLogLevel info </IfModule> NameVirtualHost 192.168.133.254 <VirtualHost 192.168.133.254> ServerAdmin clunix@clunix.org DocumentRoot /home/clunix/www ServerName clunix.org ServerAlias clunix.org www.clunix.org JkMount /*.jsp ajp13 JkMount /webapps/* ajp13 JkMount /ROOT/* ajp13 </VirtualHost> ---------------------------------------------------------------------------------- 위설정은실무에서사용되어지는 httpd.conf 파일이다. 기본적으로생성되는 httpd.conf 파일에서해당부분을추가하여사용하길바란다. apache 설정파일에대한자세한내용은 apache 관련서적이나 http://www.apache.org 사이트를참조하길바란다. 2.4.8 Tomcat 설정하기 이제 JSP 개발환경에서사용되어지는 Tomcat 설정을해보도록하자. [root@arhfw root]# vi /usr/local/tomcat/conf/workers.properies --------------------------------------------------------------------------------- workers.tomcat_home=/usr/local/tomcat 24/27 페이지
workers.java_home=/usr/java/java worker.list=ajp12, ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 --------------------------------------------------------------------------------- 2.4.9 Tomcat 과 apache 연동및가상호스트설정 apache 운영시가상호스트로운영할때각도메인별로 tomcat 역시가상호스트가지원가능하다. [root@arhfw root]# vi /usr/local/tomcat/conf/server.xml ---------------------------------------------------------------------------------.. </Host> <Host name="clunix.org"> <Context path="" docbase="/home/clunix/www" reloadable="true"/> <Alias>www.clunix.org</Alias> </Host> </Engine> </Service> </Server> ----------------------------------------------------------------------------------- 이제 apache,php, tomcat, mysql 이연동된웹시스템을구동시켜보자. - apache, php, tomcat 웹서버시작하기 25/27 페이지
[root@arhfw root]# /usr/local/apache/bin/apachectl start [root@arhfw root]# /usr/local/tomcat/bin/startup.sh - apache, php, tomcat 웹서버중지하기 만일서비스 Daemon을중지할필요가있을때는먼저 tomcat 를중지하고 apache 를중지하도록한다. [root@arhfw root]# /usr/local/tomcat/bin/shutdown.sh [root@arhfw root]# /usr/local/apache/bin/apachectl stop 2.4.10 PHP, JSP 테스트하기 - PHP 테스트하기 [root@arhfw root]# vi /home/clunix/www/phpinfo.php ----------------------------------------------------------------------------------- <? phpinfo ();?> ----------------------------------------------------------------------------------- 브라우저 : http://www.clunix.org/phpinfo.php - JSP 테스트하기 [root@arhfw root]# vi /home/syszone/clunix/jsptest.jsp ------------------------------------------------------------------------------------ <% out.println("hello, JSP"); %> ------------------------------------------------------------------------------------- 26/27 페이지
브라우저 : http://www.clunix.org/jsptest.jsp - Tomcat 테스트하기 브라우저 : http://192.168.133.254:8080 -> 고양이화면이나타나면정상적으로셋팅이완료된것이다. 27/27 페이지