ChangMan's Home
-HOME-
- LogIn -
 
3
49
157
64,641
   
  [ETC] CentOS¼³Ä¡ 11.apache
  ±Û¾´ÀÌ : ´Þ¸¶¡Ù     ³¯Â¥ : 08-05-08 17:25     Á¶È¸ : 3763    
11. ¾ÆÆÄÄ¡ ¼³Ä¡
 1) ´Ù¿î·Îµå
    http://www.apache.org
    ¾ÐÃàÇ®±â
    tar xvfz httpd-2.2.9.tar.gz -C ../
 2) MaxClient °ª Æ©´× (ÃÖ´ë 256ÀÌÁö¸¸ ÀÌ»óÀ¸·Î ¿Ã·ÁÁÝ´Ï´Ù== > 4096)
    vi /usr/local/httpd-2.2.9/server/mpm/prefork/prefork.c
    #define DEFAULT_SERVER_LIMIT 256 ºÎºÐÀ» ã¾Æ¼­
    #define DEFAULT_SERVER_LIMIT 4096 À¸·Î ¼öÁ¤ÇØ ÁÝ´Ï´Ù.
    vi /usr/local/httpd-2.2.6/server/mpm/worker/worker.c
    #define DEFAULT_SERVER_LIMIT 16  ºÎºÐÀ»
    #define DEFAULT_SERVER_LIMIT 256  À¸·Î ¼öÁ¤
* (256 * 16 = 4096)

 3) ÄÄÆÄÀÏ
./configure --prefix=/home/prog_install/apache2 \
--enable-so \
--enable-ssl \
--with-ssl=/usr/bin \
--with-mpm=worker \
--enable-modules=most \
--enable-mods-shared=most

 4) ¼³Ä¡
    make
     make¿¡¼­ /usr/lib/libexpat.so: could not read symbols: File in wrong format ¿¡·¯½Ã
  ln -s /lib64/libexp.so.0.5.0 /usr/lib/libexpat.so
  (¸¸¾à /usr/lib/libexpat.so°¡ ÀÖÀ»½Ã¿¡´Â »èÁ¦ÇÏ°í ¸µÅ©¸¦ °É¾îÁØ´Ù.)
  /usr/lib/libexpat.so: No such file or directory ¿¡·¯½Ã
  ln -s /usr/lib64/libexpat.so /usr/lib/libexpat.so
    make install
 5) ¾ÆÆÄÄ¡ ¼³Á¤
    cd /home/prog_install/apache2/conf
    a) httpd.conf
 User deamon
 Group deamon À»
 User nobody
 Group nobody ·Î º¯°æ.
 ServerName ¼­¹ö¾ÆÀÌÇÇ:80
 DocumentRoot "/home/°èÁ¤¸í/public_html" (±âº»µð·ºÅ丮·Î ¼³Á¤ http://¼­¹ö¾ÆÀÌÇÇ ÇßÀ» ¶§ º¸¿©ÁÖ´Â ÆäÀÌÁö)
 <IfModule dir_module>
   DirectoryIndex index.htm index.html  <= index.htm
 </IfModule>
 (ÇØ´ç µð·ºÅ丮¿¡ ±âº»ÀûÀ¸·Î ÀоîµéÀÏ ÆÄÀϸí - ¸¹ÀÌ ÀûÀ¸¸é ´À·ÁÁú ¼ö ÀÖ´Ù.)
 #ErrorLog logs/error_log
 ErrorLog "/dev/null"   <= Ãß°¡
 (¿¡·¯ ·Î±×¸¦ ³²±âÁö ¾Ê´Â´Ù. ¿¡·¯·Î±× ÆÄÀÏÀÌ ¸¹ÀÌ »ý¼ºµÇ¸é ¼­¹ö°¡ ´À·ÁÁú ¼ö ÀÖ´Ù.)
 #CustomLog "logs/access_log" common
 CustomLog "logs/access_log" combined env=nosave
 (Á¢¼Ó·Î±×¸¦ ³²±âÁö ¾Ê´Â´Ù. Á¢¼Ó·Î±× ÆÄÀÏÀÌ ¸¹ÀÌ »ý¼ºµÇ¸é ¼­¹ö°¡ ´À·ÁÁú ¼ö ÀÖ´Ù.)
 PHP¿Í °°ÀÌ ¼³Ä¡ÇÒ °æ¿ì (Ãß°¡)
 AddType application/x-httpd-php .php .php3 .php4 .phtml .htm .html .ph .inc
 AddType application/x-httpd-php-source .phps 
 httpd.conf ÇÏ´Ü ÀÎŬ·çµå ºÎºÐ ¼öÁ¤(ÁÖ¼®)
 Include conf/extra/httpd-mpm.conf 
 #Include conf/extra/httpd-multilang-errordoc.conf 
 #Include conf/extra/httpd-autoindex.conf 
 Include conf/extra/httpd-languages.conf 
 Include conf/extra/httpd-userdir.conf
 #Include conf/extra/httpd-info.conf   
 Include conf/extra/httpd-vhosts.conf 
 #Include conf/extra/httpd-manual.conf    
 #Include conf/extra/httpd-dav.conf
 Include conf/extra/httpd-default.conf   
 #Include conf/extra/httpd-ssl.conf
    b) conf/extra/httpd-default.conf
 MaxKeepAliveRequests 1000
 KeepAliveTimeout 25 
    c) conf/extra/httpd-userdir.conf
 <Directory /home/*/public_html> <!-----±âº»°æ·Î
    AllowOverride FileInfo AuthConfig Limit Indexes
    #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <!--ÁÖ¼®Ã³¸®ÇØ¾ß µð·ºÅ丮°¡ ¸®½ºÆ®·Î º¸ÀÌÁö ¾Ê´Â´Ù.
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
 </Directory>
    d) conf/extra/httpd-mpm.conf
 ±âº»¼³Á¤À¸·Î µÐ´Ù.
    e) conf/extra/httpd-vhosts.conf
 NameVirtualHost ¼­¹ö¾ÆÀÌÇÇ:80
 <VirtualHost ¼­¹ö¾ÆÀÌÇÇ:80>
     ServerAdmin aaa@aaaa.co.kr
     DocumentRoot "/home/°èÁ¤/public_html"
     ServerName www.aaa.co.kr
     ServerAlias aaa.co.kr
     #ErrorLog "logs/aaa.co.kr-error_log"
     #CustomLog "logs/aaa.co.kr-access_log" common
 </VirtualHost>
 
 <VirtualHost ¼­¹ö¾ÆÀÌÇÇ:80>
     ServerAdmin aaa@aaaa.co.kr
     DocumentRoot "/home/°èÁ¤/public_html"
     ServerName www.compuzone.co.kr
     #ErrorLog "logs/aaa.co.kr-error_log"
     #CustomLog "logs/aaa.co.kr-access_log" common
 </VirtualHost>

 5) ½Ã½ºÅÛ ºÎÆÃ½Ã ÀÚµ¿½ÇÇà
    vi /etc/rc.local ÆÄÀÏ¿¡ ½ÇÇà ¸í·É¾î ÀÔ·Â.
    /home/prog_install/apache2/bin/httpd -k start
   
 6) °èÁ¤ ¼³Á¤
    DocumentRoot ·Î ¼³Á¤ÇÑ °èÁ¤¿¡ Public_html Æú´õ¿Í index.htm ÆÄÀÏÀ» »ý¼º½ÃÄÑÁØ´Ù.
    (public_html : comod 755 - »ý¼ºÇÏ¸é ±âº» 755)
 7) Á¤»óÀûÀ¸·Î ³ª¿À´ÂÁö È®ÀÎ
    /home/prog_install/apache2/bin/apachectl start
 ¿¡·¯ 1.
  permission error :
  httpd: Syntax error on line 73 of /home/prog_install/apache2/conf/httpd.conf: Cannot load /home/prog_install/apache2/modules/mod_deflate.so into server:
  /home/prog_install/apache2/modules/mod_deflate.so: cannot restore segment prot after reloc: Permission denied
  =>> SELINUX °¡ ¿øÀÎÀÌ´Ù. (Æäµµ¶ó3ºÎÅÍ ±âº»Àû¿ëµÈ ÀÏÁ¾ÀÇ º¸¾È°ü·Ã ÇÁ·Î±×·¥)
    ±âº»À¸·Î ¿ÏÈ­µÈ Á¤Ã¥ÆÐŰÁöÀÎ Targeted policy ¼³Ä¡½Ã ±âº»À¸·Î Á¦°øµÈ´Ù.
    
    ÇذáÃ¥1. SELINUX¸¦ Disable ½Ã۱â
    => vi /etc/sysconfig/selinux
    => SELINUX=disable·Î ¼³Á¤
    
    ÇذáÃ¥2. chcon -t texrel_shlib_t /home/prog_install/apache2/modules/*.so
 ¿¡·¯ 2.
  httpd not running, trying to start
  (98)Address already in use: make_sock: could not bind to address [::]:80
  (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
  no listening sockets available, shutting down
  Unable to open logs
  =>> httpd ÇÁ·Î¼¼½º°¡ ¶° ÀÖÁö´Â ¾ÊÁö¸¸ 80 Æ÷Æ®¸¦ ´Ù¸¥ ÇÁ·Î¼¼½º¿¡¼­ »ç¿ëÇϱ⠶§¹®.
  
    ÇذáÃ¥1. netstat -nlp ¸í·É¾î¸¦ ÀÔ·ÂÇÑ µÚ¿¡ 80Æ÷Æ®¸¦ »ç¿ëÇϰí ÀÖ´Â ÇÁ·Î¼¼½º¸¦ Á¦°ÅÇÑ´Ù. (kill )
 ¿¡·¯ 3.
  /home/prog_install/apache2/bin/httpd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
  =>> ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

   

  Copyright¨Ï chang hyub - changman.mireene.com. All rights reserved.