Apache2¿Í Tomcat5 ¿¬µ¿Çϱâ
Apache2¿Í Tomcat5 ¿¬µ¿Çϱâ
ÀÛ¼ºÀÚ : ¹Ú»óÇö(ºê·çÆæ½Ã·´)
2006³â 7¿ù 9ÀÏ ÀÏ¿äÀÏ ¿ÀÀü 5½ÃÁò ÀÛ¼ºÀ» ½ÃÀÛÇÏ¿´½À´Ï´Ù. ±âÈÄ´Â.. Á¦ÁÖµµ·Î ÅÂdzÀÌ ºÏ»óÁßÀ̶ó°í ÇÕ´Ï´Ù.
1. ¼·Ð ¶Àú´Â »çÁ¤»ó PHP¿Í JSP ¸¦ ¸ðµÎ ó¸®ÇØÁÙ ÇÊ¿ä°¡ ÀÖ¾ú±â ¶§¹®¿¡ Apache2/Tomcat5 ¿¬µ¿ ¸ðµ¨À» ¼±ÅÃÇß½À´Ï´Ù.
°¢ÀÚ Ã³ÇÑ È¯°æ¿¡ µû¶ó¼ ÀÌ ¸ðµ¨ÀÌ ÃÖ¼±ÀÌ ¾Æ´Ò ¼öµµ ÀÖ½À´Ï´Ù. Tomcat5 ÀÇ standalone ¸ðµåµµ °í·ÁÇØÁֽñ⠹ٶø´Ï´Ù.
¿¬µ¿½Ã »ç¿ëµÇ´Â connector ¿¡´Â mod_jserv, JK, JK2, mod_webapp or mod_proxy µîÀÌ ÀÖ½À´Ï´Ù.
ÀÚ¼¼ÇÑ ³»¸·Àº ¾ËÁö´Â ¸øÇÏÁö¸¸ jserv ¿Í mod_webapp ´Â ¿À·¡ÀüºÎÅÍ ¿Ü¸é¹Þ¾Æ¿Â °Í °°°í
JK2 ´Â °³¹ßÀÚµéÀÇ Èï¹Ì ºÎÁ·À» ÀÌÀ¯·Î °³¹ßÀÌ ÁߴܵǾú½À´Ï´Ù.
µû¶ó¼ JK ¿Í mod_proxy °¡ ³²´Â µ¥.. Apache2.2 ºÎÅÍ´Â mod_proxy_ajp ¸ðµâÀÌ Á¦°øµË´Ï´Ù.
±¹³»¿¡¼´Â ÇØ´ç ¸ðµâÀ» ÀÌ¿ëÇÑ ¿¬µ¿ »ç·Ê¸¦ ãÀ» ¼ö ¾ø¾î¼ µµÀüÇغ¸¾Ò½À´Ï´Ù.
¿¬µ¿½Ã Å×½ºÆ®µÈ ȯ°æÀº ´ÙÀ½°ú °°½À´Ï´Ù.
¸®´ª½º¿¡ ÀÔ¹®ÇÑÁö ¾ó¸¶ ¾ÈµÇ¾î¼ FC5 ¿ÜÀÇ È¯°æ¿¡ ´ëÇؼ´Â Àß ¾ËÁö ¸øÇϱ⠶§¹®¿¡
Å×½ºÆ®¿¡ »ç¿ëµÈ ¼³Ä¡ ¹æ¹ýÀÌ Á¦°øµÇÁö ¾Ê°Å³ª ÀûÀýÇÏÁö ¾ÊÀ» ¼ö ÀÖÀ¸¸ç ¾ð±ÞµÈ °æ·ÎµîÀÌ ´Ù¸¦ ¼ö ÀÖ½À´Ï´Ù.
find / -name {´ë»ó} ȤÀº which {´ë»ó} µîÀ¸·Î ÀûÀýÇÑ °æ·Î¸¦ È®ÀÎÇϽñ⠹ٶø´Ï´Ù.
2. Apache 2.2 ¶
# yum -y install httpd\*
# vim /etc/httpd/conf/httpd.conf ¼¹ö°ü¸®ÀÚÀÇ email ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÝ´Ï´Ù. ¿¡·¯ÆäÀÌÁö¿¡ Ç¥½ÃµË´Ï´Ù.
ServerAdmin root@localhost ÁÖ¼®À» Ç®¾îÁÝ´Ï´Ù. ºê¶ó¿ìÀú¿¡¼ http://127.0.0.1/~°èÁ¤ À¸·Î Á¢¼ÓÇϸé /home/°èÁ¤/public_html/ ¿¡¼ À¥¹®¼À» ã°Ô µË´Ï´Ù.
<IfModule mod_userdir.c> UserDir public_html </IfModule> ¾ð¾îº° ¿ì¼± ¼øÀ§¶ó°í ÇÕ´Ï´Ù. ko ¸¦ ¸Ç ¾ÕÀ¸·Î ¿Å°ÜÁÝ´Ï´Ù.
LanguagePriority ko en ca cs da de el eo es et fr he hr it ja ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW UTF-8 À» »ç¿ëÇϱ⿣ ¾ÆÁ÷ ȯ°æÀÌ ÃæºÐÈ÷ Á¶¼ºµÇÁö ¾ÊÀº °Í °°½À´Ï´Ù. ÀÎÄÚµù ¹æ½ÄÀ» EUC-KR·Î º¯°æÇØÁÝ´Ï´Ù.
AddDefaultCharset EUC-KR
# service httpd start
# service httpd stop 3. J2SE ¶Fedora core 5 ¿¡¼´Â JDK 5.0 À» rpm.bin À» ¹Þ¾Æ¼ ¼³Ä¡ÇÒ °æ¿ì¿¡ °¢Á¾ °æ·Î ¼³Á¤ ¹®Á¦°¡ ¹ß»ýÇÏ°Ô µË´Ï´Ù.
µû¶ó¼ ´ÙÀ½ ½ÎÀÌÆ®¿¡ ³ª¿ÍÀÖ´Â ¹æ¹ýÀ» »ç¿ëÇß½À´Ï´Ù. http://www.fedorafaq.org/#java
±× ¿ÜÀÇ È¯°æ¿¡¼´Â JavaInstallation ¿¡ ³ª¿ÍÀÖ´Â ¼³Ä¡ ¹æ¹ýÀ» µû¸£½Ã±â ¹Ù¶ø´Ï´Ù.
# yum -y install rpm-build
# mv jdk-1_5_0_07-linux-i586-rpm.bin /usr/src/redhat/SOURCES/
# rpmbuild --rebuild java-1.5.0-sun-1.5.0.07-1jpp.nosrc.rpm ²Ï ¿À·¡ ÀÛ¾÷ÇÕ´Ï´Ù. Ä¿ÇÇ µå½Ã¸é¼ ±â´Ù¸³´Ï´Ù.
# yum -y localinstall /usr/src/redhat/RPMS/i586/java-1.5.0-sun-* Á¦ °æ¿ì¿¡´Â nosigned ¸Þ½ÃÁö¿Í ÇÔ²² ¼³Ä¡°¡ µÇÁö ¾Ê¾Ò½À´Ï´Ù. ÀÌ °æ¿ì¿¡´Â rpm -Uvh ·Î ¼³Ä¡ÇØÁÖ¸é µË´Ï´Ù.
¼³Ä¡ÇÏ´Â ÆÐÅ°Áö Áß¿¡ unixODBC-devel ÆÐÅ°Áö¿¡ ÀÇÁ¸¼ºÀÌ ÀÖ´Â ÆÐÅ°Áö°¡ ÀÖÀ¸´Ï ¸ÕÀú ¼³Ä¡ÇØÁÝ´Ï´Ù. # yum -y install unixODBC-devel # rpm -Uvh ~~
# java -version java version "1.5.0_07" °ú °°ÀÌ ³ª¿À¸é ¼º°øÀÔ´Ï´Ù.
¸¸¾à 1.4.2 ¹öÀüÀ¸·Î ³ª¿Â´Ù¸é alternatives ¿¡¼ java °¡ manual mode·Î 1.4.2 ¹öÀü µð·ºÅ丮¸¦ ¸µÅ©·Î »ï°í ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇϽðųª # alternatives --auto java ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇÑ ÈÄ¿¡ 1.5.0 ¹öÀü °æ·Î¸¦ ¼±ÅÃÇØÁÖ½Ã¸é µË´Ï´Ù.
# alternatives --confige java 4. Tomcat 5.5 ¶
# yum -y install tomcat5\*
# vim /usr/share/tomcat5/bin/relink ÀÌ ±¸¹®À» ã¾Æ¼ -type d ¿É¼ÇÀ» µÞÆíÀ¸·Î ¿Å°ÜÁØ´Ù.
find /var/lib/tomcat5/webapps -type d -mindepth 1 -maxdepth 2 find /var/lib/tomcat5/webapps -mindepth 1 -maxdepth 2 -type d
# vim /usr/share/tomcat5/conf/workers.properties #workers.tomcat_home=/var/tomcat workers.tomcat_home=/usr/share/tomcat5 #workers.java_home=/opt/IBMJava2-13 workers.java_home=/usr/lib/jvm/java
# vim /usr/share/tomcat5/conf/tomcat-users.xml <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="manager"/> <role rolename="admin"/> <user username="admin" password="adminpassword" roles="admin,manager,tomcat"/> </tomcat-users>
# vim /usr/share/tomcat5/conf/server.xml <Host name="localhost" ...> ... <Listener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" userClass="org.apache.catalina.startup.PasswdUserDatabase"/> ... </Host> ÀûÀýÇÑ È£½ºÆ® ¾Æ·¡¿¡ ´ÙÀ½ÀÇ Listener¸¦ Ãß°¡ÇÏ°Ô µÇ¸é /etc/passwd ÆÄÀÏÀ» Âü°í·Î Çؼ
http://127.0.0.1:8080/~user_account ·Î µé¾î¿Â Á¢¼ÓÀ» /home/user_account/public_html ·Î ¿¬°áÇÏ¿© Áشٰí ÇÕ´Ï´Ù.
# service tomcat5 start
# service tomcat5 stop 5. mod_proxy_ajp ¶mod_proxy_ajp.conf ¿¡ ±â¼úµÈ mod_proxy_ajp À» ÀÌ¿ëÇÏ´Â ¹æ¹ýÀº
´ÙÀ½°ú °°ÀÌ ¼³Á¤ÇÏ¿© ÁÜÀ¸·Î¼ ƯÁ¤ URL·Î µé¾î¿Â ¿äûÀº ÀüºÎ ÅèĹÀÌ Ã³¸®ÇÏ°Ô ÇÏ´Â °ÍÀÔ´Ï´Ù.
ProxyPass /tomcat/ ajp://localhost:8009/ÀÌ °æ¿ì¿¡´Â jsp³ª ¼ºí¸´°ú html ¹®¼¿Í À̹ÌÁöµîÀ» ¼·Î °æ·Î¸¦ ±¸ºÐÇؼ ÀúÀåÇØ¾ß º»·¡ÀÇ ¸ñÀûÀ» ´Þ¼ºÇÒ ¼ö ÀÖ´Ù´Â ¹®Á¦Á¡ÀÌ ÀÖ½À´Ï´Ù. µû¶ó¼ mod_rewirte ¸¦ ÀÌ¿ëÇؼ .jsp ÆÄÀϸ¸ ÅèĹÀÌ Ã³¸®ÇÏ´Â ¹æ¹ýÀ» »ç¿ëÇÏ¿´½À´Ï´Ù.
# vim /etc/httpd/conf.d/proxy_ajp.conf RewriteEngine On #RewriteLog /root/mod_proxy_ajp.txt #RewriteLogLevel 9 RewriteCond %{REQUEST_FILENAME} .jsp RewriteRule (.*) ajp://localhost:8009$1 [P]
# cd /usr/share/tomcat5/webapps/ROOT # mv ROOT ROOT.old # ln -s /var/www/html /usr/share/tomcat5/webapps/ROOT # cp -r /usr/share/tomcat5/webapps/ROOT.old/WEB-INF/ /usr/share/tomcat5/webapps/ROOT/WEB-INF
# service httpd start
# service tomcat5 start
# vim /var/www/html/test.jsp <%@ page contentType="text/html; Charset=EUC-KR" %> <% out.println("Hello"); %>
6. ±âŸ »çÇ× ¶Æäµµ¶ó¿¡¼ service ¸í·É¾î¸¦ ÀÎ½Ä ¸øÇÒ ¶§´Â
ÀÏ¹Ý °èÁ¤¿¡¼ root °èÁ¤À¸·Î ³Ñ¾î°¥ ¶§ su ¶ó°í¸¸ ÃÄÁ༠/sbin µð·ºÅ丮°¡ PATH ¿¡ Ãß°¡µÇÁö ¾ÊÀº °æ¿ìÀÏ ¼öµµ ÀÖ½À´Ï´Ù.
# . /etc/profileÇϽøé PATH °¡ ÀûÀýÇÏ°Ô °»½ÅµÇ¸ç service ¸í·É¾î°¡ Á¦´ë·Î ÀÎ½ÄµÉ °ÍÀÔ´Ï´Ù. ´ÙÀ½ºÎÅÍ´Â su - ¶ó°í ÀÔ·ÂÇϽô °Ô ¹Ù¶÷Á÷ÇÕ´Ï´Ù. ¹¹ Á¦°¡ Àß ¸ô¶ó¼ ±×·¨½À´Ï´Ù. Èå´ÃÈå´Ã
7. Âü°í »çÀÌÆ® ¶¾Æ·¡ÀÇ ¹®¼µé ´öºÐ¿¡ ¹«»çÈ÷ Ç×Çظ¦ ¸¶Ä¡°í ¶ó²Ù¶ó²Ù ¼ÓÀ¸·Î µé¾î°¡º¾´Ï´Ù. °¨»çÇÕ´Ï´Ù.
8. Çǵå¹é ¶¹¹¶óµµ ±¦ÂúÀ¸´Ï ÇѸ¶µð¾¿ ½áÁÖ°í °¡¼¼¿ä. ;¤±;
À½ ±Â ¤»? -- ddakker
Àß ÀÐ°í °©´Ï´Ù. ¼ö°í¿¡ °¨»çµå¸³´Ï´Ù. -- allieus
ÁÁÀº ¹®¼ °¨»çÇÕ´Ï´Ù.
ÀúÈñµµ proxy_ajp¸¦ »ç¿ëÇϴµ¥ Àú·¸°Ô rewrite¸¦ ÀÌ¿ëÇؼ ƯÁ¤ È®ÀåÀÚ¿¡ ´ëÇؼ¸¸ ó¸® ÇÒ ¼öµµ ÀÖ±º¿ä. jk Ä¿³ØÅͺ¸´Ù ÈξÀ ÆíÇϱâ´Â ÇÕ´Ï´Ù. ÁÁÀº ±Û °¨»çÇÕ´Ï´Ù.
¾Æ³ö »óÇöÀÌÇü;;; À̸§ÀÌ Àͼ÷ŸÇß´õ´Ï ¿ª½ÃÇüÀ̾ú¾î;; -- ¸ÖƼ ½Ç½ÀÁ¶±³ ¤»¤»
|
Take care of the luxuries and the necessities will take care of themselves. |