<-
Apache > HTTP Server > Documentation > Version 2.2 > ¸ðµâ

Please note

This document refers to a legacy release (2.2) of Apache httpd. The active release (2.4) is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

¾ÆÆÄÄ¡ ¸ðµâ mod_setenvif

°¡´ÉÇÑ ¾ð¾î:  en  |  ja  |  ko  |  tr 

ÀÌ ¹®¼­´Â ÃÖ½ÅÆÇ ¹ø¿ªÀÌ ¾Æ´Õ´Ï´Ù. ÃÖ±Ù¿¡ º¯°æµÈ ³»¿ëÀº ¿µ¾î ¹®¼­¸¦ Âü°íÇϼ¼¿ä.
¼³¸í:¿äûÀÇ ¼º°Ý¿¡ µû¶ó ȯ°æº¯¼ö ¼³Á¤À» º¯°æÇÑ´Ù
»óÅÂ:Base
¸ðµâ¸í:setenvif_module
¼Ò½ºÆÄÀÏ:mod_setenvif.c

¿ä¾à

mod_setenvif ¸ðµâÀº ¿äûÀÇ ¼º°ÝÀÌ Á¤±ÔÇ¥Çö½Ä¿¡ ÇØ´çÇÏ´ÂÁö ¿©ºÎ·Î ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù. ¼­¹öÀÇ ´Ù¸¥ ºÎºÐÀÌ ÇൿÀ» °áÁ¤ÇÒ¶§ ÀÌ È¯°æº¯¼ö¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù.

¼³Á¤ÆÄÀÏ¿¡ ³ª¿À´Â ¼ø¼­´ë·Î Áö½Ã¾î¸¦ ó¸®ÇÑ´Ù. ±×·¡¼­ ºê¶ó¿ìÀú°¡ MSIE°¡ ¾Æ´Ï¶ó mozillaÀÎ °æ¿ì netscape¸¦ ¼³Á¤ÇÏ´Â ¾Æ·¡ ¿¹¿Í °°ÀÌ ¿©·¯ Áö½Ã¾î¸¦ ÇÔ²² »ç¿ëÇÒ ¼ö ÀÖ´Ù.

BrowserMatch ^Mozilla netscape
BrowserMatch MSIE !netscape

Áö½Ã¾îµé

Âü°í

top

BrowserMatch Áö½Ã¾î

¼³¸í:HTTP User-Agent¿¡ µû¶ó ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù
¹®¹ý:BrowserMatch regex [!]env-variable[=value] [[!]env-variable[=value]] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess
Override ¿É¼Ç:FileInfo
»óÅÂ:Base
¸ðµâ:mod_setenvif

BrowserMatch´Â SetEnvIf Áö½Ã¾îÀÇ Æ¯º°ÇÑ °æ¿ì·Î, HTTP ¿äû Çì´õ User-Agent¿¡ µû¶ó ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù. ´ÙÀ½ µÎ ÁÙÀº °°´Ù:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot

Ãß°¡ ¿¹Á¦:

BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
BrowserMatch MSIE !javascript

top

BrowserMatchNoCase Áö½Ã¾î

¼³¸í:´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏÁö¾Ê°í User-Agent¿¡ µû¶ó ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù
¹®¹ý:BrowserMatchNoCase regex [!]env-variable[=value] [[!]env-variable[=value]] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess
Override ¿É¼Ç:FileInfo
»óÅÂ:Base
¸ðµâ:mod_setenvif

BrowserMatchNoCase Áö½Ã¾î´Â BrowserMatch Áö½Ã¾î¿Í ÀÇ¹Ì»ó °°´Ù. ±×·¯³ª ÀÌ Áö½Ã¾î´Â ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏÁö¾Ê´Â´Ù. ¿¹¸¦ µé¾î:

BrowserMatchNoCase mac platform=macintosh
BrowserMatchNoCase win platform=windows

BrowserMatch¿Í BrowserMatchNoCase Áö½Ã¾î´Â SetEnvIf¿Í SetEnvIfNoCase Áö½Ã¾îÀÇ Æ¯º°ÇÑ °æ¿ì´Ù. ´ÙÀ½ ÁÖ ÁÙÀº °°´Ù:

BrowserMatchNoCase Robot is_a_robot
SetEnvIfNoCase User-Agent Robot is_a_robot

top

SetEnvIf Áö½Ã¾î

¼³¸í:¿äûÀÇ ¼ºÁú¿¡ µû¶ó ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù
¹®¹ý:SetEnvIf attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess
Override ¿É¼Ç:FileInfo
»óÅÂ:Base
¸ðµâ:mod_setenvif

SetEnvIf Áö½Ã¾î´Â ¿äûÀÇ ¼ºÁú¿¡ µû¶ó ȯ°æº¯¼ö¸¦ Á¤ÀÇÇÑ´Ù. ù¹ø° ¾Æ±Ô¸ÕÆ® attribute´Â ´ÙÀ½ ¼¼°¡ÁöÁß Çϳª´Ù:

  1. HTTP ¿äû Çì´õ (´õ ÀÚ¼¼ÇÑ Á¤º¸´Â RFC2616 Âü°í); ¿¹¸¦ µé¾î: Host, User-Agent, Referer, Accept-Language. Á¤±ÔÇ¥Çö½ÄÀ» »ç¿ëÇÏ¿© ¿©·¯ ¿äû Çì´õ¸¦ ÁöĪÇÒ ¼ö ÀÖ´Ù.
  2. ¿äûÀÇ ´ÙÀ½ ¼ºÁúÁß Çϳª:
    • Remote_Host - (ÀÖ´Ù¸é) ¿äûÇϴ Ŭ¶óÀ̾ðÆ®ÀÇ È£½ºÆ®¸í
    • Remote_Addr - ¿äûÇϴ Ŭ¶óÀ̾ðÆ®ÀÇ IP ÁÖ¼Ò
    • Server_Addr - ¿äûÀ» ¹Þ´Â ¼­¹öÀÇ IP ÁÖ¼Ò (2.0.43 ¹öÀü ÀÌÈÄ¿¡¸¸)
    • Request_Method - »ç¿ëÇÑ ¸Þ½áµå À̸§ (GET, POST, µîµî)
    • Request_Protocol - ¿äûÀÇ ÇÁ·ÎÅäÄÝ À̸§°ú ¹öÀü (¿¹¸¦ µé¾î, "HTTP/0.9", "HTTP/1.1", µî.)
    • Request_URI - HTTP ¿äû¿¡¼­ ¿äûÇÑ ÀÚ¿ø -- ÀϹÝÀûÀ¸·Î URL¿¡¼­ ÁúÀǹ®ÀÚ¿­À» Á¦¿ÜÇÑ ½ºÅ´(scheme)°ú È£½ºÆ® ÀÌÈÄ ºÎºÐ
  3. ¿äû°ú ¿¬°üµÈ ȯ°æº¯¼ö À̸§. ±×·¡¼­ SetEnvIf Áö½Ã¾î´Â ÀÌÀü Áö½Ã¾îÀÇ °á°ú¸¦ °Ë»çÇÒ ¼ö ÀÖ´Ù. ÀÌÀü¿¡ SetEnvIf[NoCase] Áö½Ã¾î·Î Á¤ÀÇÇÑ È¯°æº¯¼ö¸¸À» °Ë»çÇÒ ¼ö ÀÖ´Ù. 'ÀÌÀü'À̶õ (¼­¹öÀü¿ª°ú °°ÀÌ) ´õ ³ÐÀº ¿µ¿ª ȤÀº Áö½Ã¾îÀÇ ÇöÀç ¿µ¿ª ÀÌÀüÀ» ¶æÇÑ´Ù. ¿äû ¼ºÁúÀÌ ¾Æ´Ï°í Á¤±ÔÇ¥Çö½ÄÀÌ ¾Æ´Ñ attribute´Â ȯ°æº¯¼ö·Î Ãë±ÞÇÑ´Ù.

µÎ¹ø° ¾Æ±Ô¸ÕÆ®´Â (regex) Perl ȣȯ Á¤±ÔÇ¥Çö½ÄÀÌ´Ù. ÀÌ´Â POSIX.2 egrepÀÇ Á¤±ÔÇ¥Çö½Ä°ú ºñ½ÁÇÏ´Ù. regex°¡ attribute¿¡ ´ëÀÀÇÏ¸é ³ª¸ÓÁö ¾Æ±Ô¸ÕÆ®¸¦ ó¸®ÇÑ´Ù.

³ª¸ÓÁö ¾Æ±Ô¸ÕÆ®´Â ¼³Á¤ÇÒ º¯¼ö¸í°ú (¼±ÅÃÀûÀÎ) ¼³Á¤°ªµéÀÌ´Ù. ´ÙÀ½°ú °°Àº Çü½ÄÀÌ´Ù

  1. varname, ȤÀº
  2. !varname, ȤÀº
  3. varname=value

ù¹ø° ÇüÅ´ °ªÀ¸·Î "1"À» »ç¿ëÇÑ´Ù. µÎ¹ø° ÇüÅ´ º¯¼ö°¡ ÀÌ¹Ì Á¤ÀÇµÈ °æ¿ì º¯¼ö¸¦ Á¦°ÅÇÏ°í, ¼¼¹ø°´Â º¯¼öÀÇ °ªÀ¸·Î value¸¦ ¼³Á¤ÇÑ´Ù. ¾ÆÆÄÄ¡ 2.0.51ºÎÅÍ value¿¡ ÀÖ´Â $1..$9¸¦ regexÀÇ °ýȣģ ÇÏÀ§Ç¥Çö½ÄÀ¸·Î ´ëüÇÑ´Ù.

¿¹Á¦:

SetEnvIf Request_URI "\.gif$" object_is_image=gif
SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
:
SetEnvIf Referer www\.mydomain\.com intra_site_referral
:
SetEnvIf object_is_image xbm XBIT_PROCESSING=1
:
SetEnvIf ^TS* ^[a-z].* HAVE_TS

óÀ½ ¼¼ ÁÙÀº À̹ÌÁö ÆÄÀÏÀ» ¿äûÇÑ °æ¿ì ȯ°æº¯¼ö object_is_image¸¦ ¼³Á¤ÇÑ´Ù. ³×¹ø° ÁÙÀº ÆäÀÌÁö¸¦ www.mydomain.com À¥»çÀÌÆ®¿¡¼­ ÂüÁ¶ÇÑ °æ¿ì intra_site_referralÀ» ¼³Á¤ÇÑ´Ù.

¸¶Áö¸· ¿¹´Â ¿äû¿¡ À̸§¿¡ "TS"·Î ½ÃÀÛÇÏ°í °ªÀÌ [a-z] Áß Çϳª·Î ½ÃÀÛÇÏ´Â Çì´õ°¡ ÀÖ´Â °æ¿ì ȯ°æº¯¼ö HAVE_TS¸¦ ¼³Á¤ÇÑ´Ù.

Âü°í

top

SetEnvIfNoCase Áö½Ã¾î

¼³¸í:´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏÁö¾Ê°í ¿äûÀÇ ¼ºÁú¿¡ µû¶ó ȯ°æº¯¼ö¸¦ ¼³Á¤ÇÑ´Ù
¹®¹ý:SetEnvIfNoCase attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess
Override ¿É¼Ç:FileInfo
»óÅÂ:Base
¸ðµâ:mod_setenvif

SetEnvIfNoCase´Â Àǹ̻ó SetEnvIf Áö½Ã¾î¿Í °°Áö¸¸, ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏÁö¾Ê°í Á¤±ÔÇ¥Çö½ÄÀ» ã´Â´Ù. ¿¹¸¦ µé¾î:

SetEnvIfNoCase Host Apache\.Org site=apache

ÀÌ °æ¿ì HTTP ¿äû Çì´õ Host:°¡ Apache.Org, apache.org µîÀ» Æ÷ÇÔÇϸé site ȯ°æº¯¼ö¸¦ "apache"·Î ¼³Á¤ÇÑ´Ù.

°¡´ÉÇÑ ¾ð¾î:  en  |  ja  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.