°¡»óÈ£½ºÆ® ´ë·®ÀÇ °¡»óÈ£½ºÆ®¸¦ µ¿ÀûÀ¸·Î ¼³Á¤Çϱâ

ÀÌ ¹®¼­´Â ¾ÆÆÄÄ¡ 1.3¿¡¼­ ´ë·®ÀÇ °¡»óÈ£½ºÆ®¸¦ È¿À²ÀûÀ¸·Î ¼­ºñ½ºÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÑ´Ù.

µ¿±â

´ç½ÅÀÇ httpd.conf¿¡ ´ÙÀ½°ú °°ÀÌ ¼­·Î ºñ½ÁÇÑ <VirtualHost> ¼½¼ÇµéÀ» ¸¹ÀÌ ÀÖ´Ù¸é ¿©±â¼­ ¼³¸íÇÏ´Â ¹æ¹ýÀÌ µµ¿òÀÌ µÉ °ÍÀÌ´Ù:

NameVirtualHost 111.22.33.44
<VirtualHost 111.22.33.44>
ServerName www.customer-1.com
DocumentRoot /www/hosts/www.customer-1.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-1.com/cgi-bin
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName www.customer-2.com
DocumentRoot /www/hosts/www.customer-2.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-2.com/cgi-bin
</VirtualHost>
# ¹Ùº¸ ¹Ùº¸ ¹Ùº¸
<VirtualHost 111.22.33.44>
ServerName www.customer-N.com
DocumentRoot /www/hosts/www.customer-N.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-N.com/cgi-bin
</VirtualHost>

±âº» °³³äÀº Á¤ÀûÀÎ <VirtualHost> ¼³Á¤ ¸ðµÎ¸¦ µ¿ÀûÀ¸·Î ó¸®Çϵµ·Ï ´ëüÇÏ´Â °ÍÀÌ´Ù. ±×·¯¸é ¸¹Àº ÀåÁ¡ÀÌ ÀÖ´Ù:

  1. ¼³Á¤ÆÄÀÏÀÌ ÀÛ¾ÆÁ®¼­ ¾ÆÆÄÄ¡°¡ »¡¸® ½ÃÀÛÇÏ°í ¸Þ¸ð¸®¸¦ Àû°Ô »ç¿ëÇÑ´Ù.
  2. °¡»óÈ£½ºÆ®¸¦ Ãß°¡ÇϱâÀ§ÇØ ÆÄÀϽýºÅÛ¿¡ Àû´çÇÑ µð·ºÅ丮¸¦ ¸¸µé°í DNS¿¡ Ç׸ñÀ» Ãß°¡Çϱ⸸ ÇϸéµÈ´Ù. Áï, ¾ÆÆÄÄ¡¸¦ Àç¼³Á¤ÇÏ°í Àç½ÃÀÛÇÒ ÇÊ¿ä°¡ ¾ø´Ù.

´ÜÁ¡Àº °¢ °¡»óÈ£½ºÆ®º°·Î ´Ù¸¥ ·Î±×ÆÄÀÏÀ» »ç¿ëÇÒ ¼ö ¾ø´Ù´Â Á¡ÀÌ´Ù. ±×·¯³ª ¸Å¿ì ¸¹Àº °¡»óÈ£½ºÆ®¸¦ »ç¿ëÇÑ´Ù¸é ÆÄÀϱâ¼úÀÚ¸¦ ´Ù ½á¹ö¸®±â¶§¹®¿¡ ¼­·Î ´Ù¸¥ ·Î±×ÆÄÀÏÀ» »ç¿ëÇÒ ¼ö ¾ø´Ù. ÆÄÀÌÇÁ³ª fifo·Î ·Î±×¸¦ º¸³»°í, ¹Þ´Â Æí¿¡¼­ ·Î±×¸¦ ó¸®ÇÏ¿© ³ª´©´Â ¹æ¹ýÀÌ (Åë°è µîÀ» ¸ðÀ» ¼öµµ ÀÖ´Ù) ´õ ³´´Ù.

°³¿ä

°¡»óÈ£½ºÆ®´Â IP ÁÖ¼Ò¿Í HTTP ¿äûÀÇ Host: Çì´õ Á¤º¸·Î Á¤ÀÇÇÑ´Ù. ±âº»ÀûÀ¸·Î ´ë·®ÀÇ µ¿Àû °¡»óÈ£½ºÆ® ±â¼úÀº ÀÚµ¿À¸·Î °¡»óÈ£½ºÆ® Á¤º¸¸¦ ¿äûÀÇ ÆÄÀÏ°æ·Î¿¡ Æ÷ÇÔÇÑ´Ù. ÀÌ´Â ´ëºÎºÐ mod_vhost_alias¸¦ »ç¿ëÇÏ¿© ½±°Ô ÇØ°áÇÒ ¼ö ÀÖÁö¸¸, ¾ÆÆÄÄ¡ 1.3.6 ÀÌÇϸ¦ »ç¿ëÇÑ´Ù¸é mod_rewrite¸¦ »ç¿ëÇØ¾ß ÇÑ´Ù. ÀÌ µÎ ¸ðµâ ¸ðµÎ ±âº»ÀûÀ¸·Î ¼­¹ö¿¡ Æ÷ÇÔµÇÁö ¾Ê´Â´Ù. ÀÌ ¹æ¹ýÀ» »ç¿ëÇÏ·Á¸é ¾ÆÆÄÄ¡¸¦ ±¸¼ºÇÏ°í ÄÄÆÄÀÏÇÒ¶§ Æ÷ÇÔÇØ¾ß ÇÑ´Ù.

µ¿Àû °¡»óÈ£½ºÆ®¸¦ ÀϹÝÀûÀÎ °¡»óÈ£½ºÆ®Ã³·³ º¸ÀÌ°ÔÇÏ·Á¸é ¿©·¯°¡Áö¸¦ `¼Ó¿©¾ß' ÇÑ´Ù. °¡Àå Áß¿äÇÑ °ÍÀº ¾ÆÆÄÄ¡°¡ ÀÚ±âÂüÁ¶ URL µîÀ» ¸¸µé¶§ »ç¿ëÇÒ ¼­¹ö¸íÀÌ´Ù. ¼­¹ö¸íÀº ServerName Áö½Ã¾î·Î ¼³Á¤Çϸç, CGI¿¡´Â SERVER_NAME ȯ°æº¯¼ö·Î ÁÖ¾îÁø´Ù. ½ÇÇàÁß ½ÇÁ¦ ¼­¹ö¸íÀº UseCanonicalName ¼³Á¤¿¡ ´Þ·È´Ù. UseCanonicalName OffÀÌ¸é ¿äûÀÇ Host: Çì´õ ³»¿ëÀÌ ¼­¹ö¸íÀÌ µÈ´Ù. UseCanonicalName DNSÀÌ¸é °¡»óÈ£½ºÆ®ÀÇ IP ÁÖ¼Ò¸¦ ¿ªDNS °Ë»öÇÏ¿© ¼­¹ö¸íÀ» ¾Ë¾Æ³½´Ù. ÀüÀÚ´Â À̸§±â¹Ý µ¿Àû °¡»óÈ£½ºÆ®¿¡¼­ »ç¿ëÇÏ°í, ÈÄÀÚ´Â IP±â¹Ý °¡»óÈ£½ºÆ®¿¡¼­ »ç¿ëÇÑ´Ù. Host: Çì´õ°¡ ¾ø°Å³ª DNS °Ë»öÀÌ ½ÇÆÐÇÏ¿© ¾ÆÆÄÄ¡°¡ ¼­¹ö¸íÀ» ¾Ë¾Æ³»Áö ¸øÇϸé ServerNameÀ¸·Î ¼³Á¤ÇÑ °ªÀ» ´ë½Å »ç¿ëÇÑ´Ù.

´Ù¸¥ `¼ÓÀÏ' °ÍÀº (DocumentRoot·Î ¼³Á¤Çϸç, CGI¿¡´Â DOCUMENT_ROOT ȯ°æº¯¼ö·Î ÁÖ¾îÁö´Â) ¹®¼­·çÆ®ÀÌ´Ù. ÀϹÝÀûÀÎ °æ¿ì core ¸ðµâÀÌ ÀÌ ¼³Á¤À» »ç¿ëÇÏ¿© URI¿¡ ÇØ´çÇÏ´Â ÆÄÀϸíÀ» ãÁö¸¸, ¼­¹ö¸¦ µ¿Àû °¡»óÈ£½ºÆÃÀ» ÇÒ¶§´Â ´Ù¸¥ ¸ðµâÀÌ (mod_vhost_alias³ª mod_rewrite) ´Ù¸¥ ¹æ¹ýÀ¸·Î ÀÌ·± ÀÛ¾÷À» ÇÑ´Ù. µÎ ¸ðµâ ¸ðµÎ DOCUMENT_ROOT ȯ°æº¯¼ö¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¹Ç·Î CGI³ª SSI ¹®¼­°¡ ÀÌ °ªÀ» »ç¿ëÇÑ´Ù¸é À߸øµÈ °á°ú¸¦ ¾òÀ» ¼ö ÀÖ´Ù.

°£´ÜÇÑ µ¿Àû °¡»óÈ£½ºÆ®

À§ µ¿±â ÀýÀÇ °¡»óÈ£½ºÆ® ¼³Á¤À» mod_vhost_alias¸¦ »ç¿ëÇÏ¿© ´õ ÀϹÝÀûÀ¸·Î ±¸ÇöÇß´Ù.

# Host: Çì´õ¿¡¼­ ¼­¹ö¸íÀ» ¾Ë¾Æ³½´Ù
UseCanonicalName Off

# ù¹ø° Çʵ带 »ç¿ëÇÏ¿© ÀÌ ·Î±×¸¦ °¡»óÈ£½ºÆ®º°·Î ³ª´­ ¼ö ÀÖ´Ù
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# ¿äûÀ» ó¸®ÇϱâÀ§ÇØ ÆÄÀÏ¸í¿¡ ¼­¹ö¸íÀ» Æ÷ÇÔÇÑ´Ù
VirtualDocumentRoot /www/hosts/%0/docs
VirtualScriptAlias /www/hosts/%0/cgi-bin

ÀÌ ¼³Á¤¿¡¼­ UseCanonicalName Off¸¦ UseCanonicalName DNS·Î º¯°æÇϱ⸸ Çϸé IP±â¹Ý °¡»óÈ£½ºÆ®°¡ µÈ´Ù. °¡»óÈ£½ºÆ®ÀÇ IP ÁÖ¼Ò¸¦ °¡Áö°í ÆÄÀÏ¸í¿¡ Ãß°¡ÇÒ ¼­¹ö¸íÀ» ¾Ë ¼ö ÀÖ´Ù.

°¡»óÀ¸·Î È£½ºÆ®Çϴ ȨÆäÀÌÁö ½Ã½ºÅÛ

ISP ȨÆäÀÌÁö ¼­¹ö¸¦ À§ÇØ À§ÀÇ ¼³Á¤À» ¼öÁ¤Çß´Ù. Á¶±Ý ´õ º¹ÀâÇÑ ¼³Á¤À» »ç¿ëÇϸé www.user.isp.comÀÇ ¹®¼­¸¦ /home/user/¿¡ µÎ´Â ½ÄÀ¸·Î ¼­¹ö¸íÀÇ ÀϺθ¦ °¡Áö°í ÆÄÀϸíÀ» ¸¸µé ¼ö ÀÖ´Ù. ÀÌ ¼³Á¤Àº cgi-binÀ» °¢ °¡»óÈ£½ºÆ®°¡ µû·Î °¡ÁöÁö¾Ê°í ¸ðµç °¡»óÈ£½ºÆ®°¡ °°ÀÌ »ç¿ëÇÑ´Ù.

# ±âº»ÀûÀÎ ³»¿ëÀº À§¿Í °°´Ù. ±×¸®°í

# ÆÄÀÏ¸í¿¡ ¼­¹ö¸íÀÇ ÀϺθ¦ Æ÷ÇÔÇÑ´Ù
VirtualDocumentRoot /www/hosts/%2/docs

# ÇϳªÀÇ cgi-bin µð·ºÅ丮
ScriptAlias /cgi-bin/ /www/std-cgi/

mod_vhost_alias ¹®¼­¿¡´Â ´õ º¹ÀâÇÑ VirtualDocumentRoot ¼³Á¤ÀÇ ¿¹°¡ ÀÖ´Ù.

ÇÑ ¼­¹ö¿¡ ¿©·¯ °¡»óÈ£½ºÆ® ½Ã½ºÅÛ »ç¿ëÇϱâ

´õ º¹ÀâÇÑ ¼³Á¤ÀÇ ¿¹·Î ¾ÆÆÄÄ¡ÀÇ ÀϹÝÀûÀÎ <VirtualHost> Áö½Ã¾î¸¦ »ç¿ëÇÏ¿© ¿©·¯ °¡»óÈ£½ºÆ® ¼³Á¤ÀÇ ¹üÀ§¸¦ Á¶ÀýÇÒ ¼ö ÀÖ´Ù. ¿¹¸¦ µé¾î, ´ÙÀ½°ú °°Àº ¼³Á¤Àº ȨÆäÀÌÁö °í°´¿¡ IP ÁÖ¼Ò ÇÑ°³, »ó¾÷ÀûÀÎ °í°´¿¡°Ô ´Ù¸¥ IP ÁÖ¼Ò ÇÑ°³¸¦ ºÎ¿©ÇÑ´Ù. ¹°·Ð ÀÌÀüó·³ <VirtualHost> ¼³Á¤ ¼½¼Ç¿¡ ¸ðµÎ ¹­À» ¼öµµ ÀÖ´Ù.

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

<Directory /www/commercial>
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory /www/homepages>
Options FollowSymLinks
AllowOverride None
</Directory>

<VirtualHost 111.22.33.44>
ServerName www.commercial.isp.com

CustomLog logs/access_log.commercial vcommon

VirtualDocumentRoot /www/commercial/%0/docs
VirtualScriptAlias /www/commercial/%0/cgi-bin
</VirtualHost>

<VirtualHost 111.22.33.45>
ServerName www.homepages.isp.com

CustomLog logs/access_log.homepages vcommon

VirtualDocumentRoot /www/homepages/%0/docs
ScriptAlias /cgi-bin/ /www/std-cgi/
</VirtualHost>
´õ È¿À²ÀûÀÎ IP±â¹Ý °¡»óÈ£½ºÆ®

ù¹ø° ¿¹¿¡¼­ ³ª´Â ¼³Á¤À» °£´ÜÈ÷ IP±â¹Ý °¡»óÈ£½ºÆ®·Î ¹Ù²Ü ¼ö ÀÖ´Ù°í ¸»Çß´Ù. ºÒÇàÈ÷µµ ±×·± ¼³Á¤Àº ¸Å ¿äû¸¶´Ù DNS¸¦ ã¾Æ¾ßÇϹǷΠ¸Å¿ì ºñÈ¿À²ÀûÀÌ´Ù. À̸§´ë½Å IP ÁÖ¼Ò·Î ÆÄÀϽýºÅÛÀ» ±¸¼ºÇÏ°í °°Àº ¹æ½ÄÀ¸·Î ·Î±×¸¦ ¼öÁ¤ÇÏ¸é ¹®Á¦¸¦ ÇØ°áÇÒ ¼ö ÀÖ´Ù. ¾ÆÆÄÄ¡´Â ¼­¹ö¸íÀ» ´Ù·ê ÇÊ¿ä°¡ ¾ø¾îÁö°í, DNS °Ë»öµµ ÇÏÁö ¾Ê°Ô µÈ´Ù.

# IP ÁÖ¼Ò¸¦ ¿ªDNS °Ë»öÇÏ¿© ¼­¹ö¸íÀ» ¾Ë¾Æ³½´Ù
UseCanonicalName DNS

# ·Î±×¸¦ ³ª´­ ¼ö ÀÖµµ·Ï IP ÁÖ¼Ò¸¦ Æ÷ÇÔÇÑ´Ù
LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# ÆÄÀÏ¸í¿¡ IP ÁÖ¼Ò¸¦ Æ÷ÇÔÇÑ´Ù
VirtualDocumentRootIP /www/hosts/%0/docs
VirtualScriptAliasIP /www/hosts/%0/cgi-bin
¾ÆÆÄÄ¡ ÀÌÀü ¹öÀü »ç¿ëÇϱâ

À§ ¿¹µéÀº ¾ÆÆÄÄ¡ ¹öÀü 1.3.6 ÀÌÈÄ¿¡ Æ÷ÇÔµÈ mod_vhost_aliasÀ» »ç¿ëÇÑ´Ù. mod_vhost_alias°¡ ¾ø´Â ¾ÆÆÄÄ¡ ¹öÀüÀ» »ç¿ëÇÑ´Ù¸é ÀÌ¹Ì ¸»ÇßµíÀÌ mod_rewrite¸¦ »ç¿ëÇÏ¿©, ´Ü Host:-Çì´õ±â¹Ý °¡»óÈ£½ºÆ®¸¸À», ±¸ÇöÇÒ ¼ö ÀÖ´Ù.

¶Ç ·Î±×¿¡ °üÇÏ¿© ÁÖÀÇÇÒ Á¡ÀÌ ÀÖ´Ù. ¾ÆÆÄÄ¡ 1.3.6¿¡¼­ ·Î±×Çü½Ä Áö½Ã¾î %V°¡ Æ÷ÇԵǾú°í, ¹öÀü 1.3.0 - 1.3.3¿¡¼­ ÀÌ ±â´ÉÀ» %v ¿É¼ÇÀÌ ´ë½Å Çß´Ù. ±×·¯³ª ¹öÀü 1.3.4¿¡´Â ÀÌ·± ±â´ÉÀÌ ¾ø´Ù. ¾î¶² ¾ÆÆÄÄ¡ ¹öÀü¿¡¼­µµ .htaccess ÆÄÀÏ¿¡¼­ UseCanonicalName Áö½Ã¾î¸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸¹Ç·Î ·Î±×¿¡ ÀÌ»óÇÑ ³»¿ëÀÌ ±â·ÏµÉ ¼ö ÀÖ´Ù. ±×·¯¹Ç·Î °¡Àå ÁÁÀº ¹æ¹ýÀº %{Host}i Áö½Ã¾î¸¦ »ç¿ëÇÏ¿© Host: Çì´õ¸¦ Á÷Á¢ ·Î±×¿¡ ³²±â´Â °ÍÀÌ´Ù. ¶Ç, ÀÌ ¹æ¹ýÀº %V´Â Æ÷ÇÔÇÏÁö¾Ê´Â :port¸¦ µÚ¿¡ Ãß°¡ÇÒ ¼ö ÀÖ´Ù.

<code>mod_rewrite</code>¸¦ »ç¿ëÇÑ °£´ÜÇÑ µ¿Àû °¡»óÈ£½ºÆ®

´ÙÀ½Àº ù¹ø° ¿¹¿Í °°Àº ÀÏÀ» ÇÏ´Â httpd.conf ¿¹ÀÌ´Ù. óÀ½ Àý¹ÝÀº ù¹ø° ¿¹¿Í °ÅÀÇ ºñ½ÁÇÏÁö¸¸, ÀÌÀü ¹öÀü°úÀÇ È£È¯¼º°ú mod_rewriteÀÇ ÀûÀýÇÑ µ¿ÀÛÀ» À§ÇØ ¼öÁ¤µÇ¾ú´Ù. ³ª¸ÓÁö Àý¹ÝÀº ½ÇÁ¦ ÀÛ¾÷À» ÇÏ´Â mod_rewrite¸¦ ¼³Á¤ÇÑ´Ù.

Ưº°È÷ ÁÖÀÇÇØ¾ß ÇÒ »çÇ×ÀÌ ÀÖ´Ù. ±âº»ÀûÀ¸·Î mod_rewrite´Â (mod_alias µî) ´Ù¸¥ URI ¹ø¿ª ¸ðµâ ÀÌÀü¿¡ ½ÇÇàµÈ´Ù. ±×·¡¼­ ´Ù¸¥ URI ¹ø¿ª ¸ðµâµé°ú °°ÀÌ µ¿ÀÛÇÒ °ÍÀ» °í·ÁÇÏ¿© mod_rewrite¸¦ ¼³Á¤ÇØ¾ß ÇÑ´Ù. ¶Ç, µ¿Àû °¡»óÈ£½ºÆ®¿¡¼­ ScriptAlias°ú °°Àº ±â´ÉÀ» À§Çؼ­´Â Ưº°ÇÑ ÀÛ¾÷ÀÌ ÇÊ¿äÇÏ´Ù.

# Host: Çì´õ¿¡¼­ ¼­¹ö¸íÀ» ¾ò´Â´Ù
UseCanonicalName Off

# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<Directory /www/hosts>
# ScriptAlias ½ÄÀ¸·Î CGI ½ÇÇàÀ» °­Á¦ÇÒ ¼ö ¾ø±â¶§¹®¿¡
# ¿©±â¿¡ ExecCGI¸¦ »ç¿ëÇÑ´Ù
Options FollowSymLinks ExecCGI
</Directory>

# ÀÌÁ¦ ¾î·Á¿î ºÎºÐÀÌ´Ù

RewriteEngine On

# Host: Çì´õ¿¡¼­ °¡Á®¿Â ¼­¹ö¸í¿¡´Â ´ë¼Ò¹®ÀÚ°¡ µÚ¼¯¿©ÀÖÀ» ¼ö ÀÖ´Ù
RewriteMap lowercase int:tolower

## ÀÏ¹Ý ¹®¼­¸¦ ¸ÕÀú ó¸®ÇÑ´Ù:
# Alias /icons/ °¡ µ¿ÀÛÇϵµ·Ï - ´Ù¸¥ alias¿¡ ´ëÇؼ­µµ ¹Ýº¹
RewriteCond %{REQUEST_URI} !^/icons/
# CGI°¡ µ¿ÀÛÇϵµ·Ï
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# Ưº°ÇÑ ÀÛ¾÷
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1

## ÀÌÁ¦ CGI¸¦ ó¸®ÇÑ´Ù - MIME typeÀ» °­Á¦ÇØ¾ß ÇÑ´Ù
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=application/x-httpd-cgi]

# ³¡!
<code>mod_rewrite</code>¸¦ »ç¿ëÇÑ È¨ÆäÀÌÁö ½Ã½ºÅÛ

´ÙÀ½Àº µÎ¹ø° ¿¹¿Í °°Àº ÀÏÀ» ÇÑ´Ù.

RewriteEngine on

RewriteMap lowercase int:tolower

# CGI°¡ µ¿ÀÛÇϵµ·Ï
RewriteCond %{REQUEST_URI} !^/cgi-bin/

# RewriteRuleÀÌ µ¿ÀÛÇϵµ·Ï È£½ºÆ®¸íÀÌ ¿Ã¹Ù¸¥Áö °Ë»çÇÑ´Ù
RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.isp\.com$

# °¡»óÈ£½ºÆ®¸íÀ» URI ¾Õ¿¡ ºÙÀδÙ
# [C]´Â ÀÌ °á°ú¸¦ °¡Áö°í ´ÙÀ½ ÀçÀÛ¼ºÀ» ¼öÇàÇÔÀ» ¶æÇÑ´Ù
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]

# ÀÌÁ¦ ½ÇÁ¦ ÆÄÀϸíÀ» ¸¸µç´Ù
RewriteRule ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2

# Àüü CGI µð·ºÅ丮¸¦ Á¤ÀÇÇÑ´Ù
ScriptAlias /cgi-bin/ /www/std-cgi/
º°µµÀÇ °¡»óÈ£½ºÆ® ¼³Á¤ÆÄÀÏ »ç¿ëÇϱâ

´ÙÀ½Àº mod_rewriteÀÇ °í±Þ ±â´ÉÀ» »ç¿ëÇÏ¿© º°µµÀÇ ¼³Á¤ÆÄÀÏÀ» °¡Áö°í °¡»óÈ£½ºÆ®ÀÇ ¹®¼­·çÆ®¸¦ ¾Ë¾Æ³½´Ù. ´õ À¯¿¬ÇÏÁö¸¸ ´õ º¹ÀâÇÑ ¼³Á¤ÀÌ ÇÊ¿äÇÏ´Ù.

vhost.map ÆÄÀÏÀº ´ÙÀ½°ú °°´Ù:

www.customer-1.com /www/customers/1
www.customer-2.com /www/customers/2
# ...
www.customer-N.com /www/customers/N

http.conf´Â ´ÙÀ½°ú °°´Ù:

RewriteEngine on

RewriteMap lowercase int:tolower

# ´ëÀÀÆÄÀÏÀ» Á¤ÀÇÇÑ´Ù
RewriteMap vhost txt:/www/conf/vhost.map

# À§¿Í °°ÀÌ aliasµéÀ» ó¸®ÇÑ´Ù
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# ÆÄÀÏ ³»¿ëÀ» °¡Áö°í ã´Â´Ù
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/docs/$1

RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1