B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-23 Monday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 105 article 2002-02-20 20:08:21
NickName   Ç®ºñ´©
Subject   À¯µ¿IP¿¡¼­ÀÇ ¾ÆÆÄÄ¡ °¡»óÈ£½ºÆ® ¼³Á¤ ½ºÅ©¸³Æ®
±ÛÃâó : http://wowdns.com

Àá±ñ «À» ³» ¸¸µé¾î º¸¾Ò½À´Ï´Ù.. 
¼³Á¤»çÇ×Àº ·¹µåÇò 7.1 ±âÁØÀÔ´Ï´Ù. 
±×¿Ü ½Ã½ºÅÛ »ç¿ëÀÚ´Â ¾Ë¸Â°Ô º¯°æÈÄ »ç¿ëÇϽñ⠹ٶø´Ï´Ù. 
------------------------------------------------------------------------------------------ 

#!/bin/sh

DEVICE=eth0
NEWIP=`/sbin/ifconfig $DEVICE | grep "inet " | awk '{print $2}' | cut -c6-`
IPFILE='/etc/httpd/conf/vhost.ip'
VHOSTCONF='/etc/httpd/conf/vhost.conf'
HTTPDRUN="/etc/init.d/httpd restart"

modify_vhost()
{
        echo "$NEWIP" > $IPFILE
        TMPFILE=`sed s/$OLDIP/$NEWIP/g $VHOSTCONF`
        echo "$TMPFILE" > $VHOSTCONF
        echo "`$HTTPDRUN`" 
}

if [ -f "$IPFILE" ] ; then
        OLDIP=`cat $IPFILE`
        if [ "$NEWIP" != "$OLDIP" ] ; then
                modify_vhost
        fi
else
        modify_vhost
fi


------------------------------------------------------------------------------------------ 

¾ÆÁÖ °£´ÜÇÏÁÒ ? 

À§ÀÇ ½ºÅ©¸³Æ® ¼³Á¤¿¡ ÇÊ¿äÇÑ ºÎºÐÀ» ¼³¸í µå¸®°Ú½À´Ï´Ù. 

DEVICE ´Â ÀÎÅÍ³Ý ÀÌ¿ë ÇüÅ·νá ifconfig ¸í·É½Ã ½Ç IP¸¦ °®°í ÀÖ´Â 
ÀåÄ¡¸¦ ³ªÅ¸ ³À´Ï´Ù. 
ADSL »ç¿ëÀÚ´Â ppp0 CABLE ¶Ç´Â LAN »ç¿ëÀÚ´Â eth0 °¡ µË´Ï´Ù.. 
(±×¿Ü FreeBSD³ª ¿©·¯°³ÀÇ ·£Ä«µå »ç¿ëÀÚ´Â ifconfig ½ÇÇàÈÄ È®ÀÎ) 

IPFILE Àº ºÒÇÊ¿äÇÑ ¾ÆÆÄÄ¡ Àç½ÇÇàÀ» ¸·±â À§ÇØ IP°¡ ¹Ù²ð¶§¸¸ ½ÇÇà Çϵµ·Ï ÀÌÀü IP¸¦ º¸°üÇÒ È­ÀÏÀÔ´Ï´Ù.. 

VHOSTFILE Àº °¡»ó È£½ºÆ® ¼³Á¤È­ÀÏÀÌ ÀÖ´Â È­ÀÏÀÔ´Ï´Ù. 

HTTPDRUNÀº Àç½ÃÀÛ ¸í·ÉÀÔ´Ï´Ù. 
kill -HUP `cat /var/run/httpd.pid` µµ µÉµí Çѵ¥.. 
Àß ¾È¸Ô³×¿ä.. 

ÀÚ ±×·³ ½ÇÁ¦ Àû¿ëÇÏ´Â ¹æ¹ýÀ» °¡¸£ÃÄ µå¸®°Ú½À´Ï´Ù. 
* ¸ðµç ÀÛ¾÷Àº root ±ÇÇÑ¿¡¼­ ½ÇÇàµÇ¾î¾ß ÇÕ´Ï´Ù. 

1. À§ÀÇ ¼Ò½º¸¸ Ä«ÇÇÈÄ ip.sh ·Î È­ÀÏÀ» ¸¸µé¾î ÀúÀåÇÑ´Ù. 
( /usr/local/sbin/ µð·ºÅ丮³ª ±âŸ ÀÓÀÇ·Î ÀúÀå Çϼ¼¿ä..) 
2. ±ÇÇÑ ¼³Á¤... chmod 755 ip.sh (ÀÓÀÇ ¼öÁ¤ °¡´É) 
3. ¾ÆÆÄÄ¡ ¼³Á¤È­ÀÏÀÌ ÀÖ´Â µð·ºÅ丮·Î À̵¿ ÇÏ¿© vhost.conf ¶õ È­ÀÏÀ» ¸¸µì´Ï´Ù. 
4. ¾ÆÆÄÄ¡ ¼³Á¤È­ÀÏ¿¡¼­ °¡»ó È£½ºÆ® ¼³Á¤ÇÏ´Â ºÎºÐ¸¸ ÀÓÀÇ·Î »©³À´Ï´Ù. 
5. »©³½ºÎºÐÀ» vhost.conf¿¡ º¹»çÇÏ°í ¾ÆÆÄÄ¡ ¼³Á¤È­ÀÏ¿¡¼­´Â »èÁ¦¸¦ ÇÕ´Ï´Ù. 
6. »èÁ¦ÈÄ ¾ÆÆÄÄ¡ conf È­ÀÏ Á¦ÀÏ ÇÏ´Ü¿¡ include conf/vhost.conf ¸¦ Ãß°¡ ÇÏ¿© ÀúÀåÇÕ´Ï´Ù. 
7. ifconfig ¸í·ÉµîÀ¸·Î ÇöÀç ½Ã½ºÅÛÀÇ IP¸¦ È®ÀÎÇÏ°í vhost.conf¿¡ ¾Ë¸Â°Ô °¡»óÈ£½ºÆ® ¼³Á¤À» ÇÕ´Ï´Ù. 
( Ȥ½Ã ¸ð¸£´Ï ¸¸µé¾îÁø vhost.conf È­ÀÏÀ» Çϳª ¹é¾÷ ¹Þ¾Æ µÓ´Ï´Ù.) 
8. ÀÌÁ¦ ip.sh ¸¦ ½ÇÇà½ÃÄÑ º¾´Ï´Ù.. 
9. Å©·ÐÀ̳ª ±âŸ Á¤±âÀûÀÎ ¼öÇàÀÌ °¡´ÉÇÑ ÇÁ·Î±×·¥À» ÀÌ¿ëÇÏ¿© ¿øÇÏ´Â ½Ã°£¸¶´Ù üũ Çϵµ·Ï ÇÕ´Ï´Ù.. 

* ÁÖÀÇ 
----------ÃÖÃÊ ¼³Ä¡½Ã ¹Ýµå½Ã È®ÀÎÇØ ÁÖ¼¼¿ä..------------ 
IP°¡ ÀúÀåµÇ´Â IPFILEÀÇ °ªÀ» Àß ¼³Á¤ÇÏ¼Å¾ß Çϴµ¥ ¹Ýµå½Ã ¼³Á¤½ÃÀÇ IP°ªÀÌ µé¾î°¡ ÀÖ¾î¾ß ÇÕ´Ï´Ù. 
´õºÒ¾î, ip.sh ½ºÅ©¸³Æ®¸¦ ½ÇÇàÇϱâ Àü¿¡ ¹Ýµå½Ã vhost.conf¿¡ 
°¡»ó È£½ºÆ® ¼³Á¤ÀÌ µÇ¾î ÀÖ¾î¾ß ÇÕ´Ï´Ù.. 
À̶§, ¼³Á¤½Ã »ðÀÔµÈ IP´Â IPFILE¿¡ ÀÖ´Â IP¿Í µ¿ÀÏÇØ¾ß ÇÕ´Ï´Ù.. 

----------- vhost.conf ¿¹Á¦È­ÀÏ ------------ 

NameVirtualHost 211.53.206.101 


ServerAdmin root at sample.com 
DocumentRoot /var/www/ 
ServerName sample.com 
#¾Æ·¡ ºÎºÐÀº IE6¿¡¼­ ÄíÅ°°¡ ¾ÈµÇ´Â Á¡À» ÇØ°áÇÏ´Â ºÎºÐÀÔ´Ï´Ù. 
#ÀÌ ºÎºÐ¿¡ ´ëÇؼ­´Â 'IE¿¡¼­ ÄíÅ°°¡ ¾ÈµÉ¶§' °Ô½ÃÆÇÀ» Âü°í Çϼ¼¿ä. 
Header set P3P "CP='CAO PSA CONi OTR OUR DEM ONL'" 
ErrorLog /var/log/httpd/sample.com-error.log 
TransferLog /var/log/httpd/sample.com-access.log 
Options ExecCGI 



ServerAdmin root at sample.com 
DocumentRoot /var/www/website2/ 
ServerName good.com 
Header set P3P "CP='CAO PSA CONi OTR OUR DEM ONL'" 
ErrorLog /var/log/httpd/good.com-error.log 
TransferLog /var/log/httpd/good.com-access.log 
Options ExecCGI 


---------------------------------------------------------------------- 

* ÇÁ·Î±×·¥ ±â´É ¹× Ư¡ 
½ÇÇà½Ã ÀÌÀü ¼³Á¤°ªÀ» ºñ±³ÇÏ¿© IPº¯µ¿ÀÌ ¾øÀ»¶§´Â ±×³É Á¾·áÇϵµ·Ï 
µÇ¾î ÀÖ¾î ¹«Á¶°ÇÀûÀÎ ¾ÆÆÄÄ¡ Àç½ÇÇàÀ» ¸·¾Æ ÁÝ´Ï´Ù.. 
±×¿Ü..... ¼Ò½º°¡ ½±°í ª½À´Ï´Ù.. 

* ±âŸ ¹ö±× ¹× ¹®ÀÇ »çÇ×Àº °Ô½ÃÆÇ¿¡ ³²°Ü ÁÖ¼¼¿ä.. 

* À̱ÛÀº GPL À» µû¸£¸ç, ´Ù¸¥°÷¿¡ ¿Å±â½Ç¶§´Â ¿øÁ¦ÀÛÀÚ ¹× »çÀÌÆ®¸¦ ¸í½ÃÇØ Áֽñ⠹ٶø´Ï´Ù. 

http://wowdns.com 
ÇÑÁ¤¼® 
-------------------------------------------------------------------- 
ÀÌÀü¿¡ ¹Þ¾ÒÀ»ºÐµéÀ» À§ÇÑ °£´ÜÇÑ history. 
-------------------------------------------------------------------- 
1. /var/run/vhost.ip -> /etc/http.conf/vhost.ip ·Î µÇ¾ú½À´Ï´Ù.(2002.2.10) 
2. device º¯¼ö ´©¶ôºÎºÐÀ» °íÃÆÀ¾´Ï´Ù.
Regist Addr [ 192.168.0.2 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®