Apache HTTP Server Version 2.2
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.
¼³¸í: | ¾ÆÆÄÄ¡ ¸ðµâ API¸¦ ¼³¸íÇÑ´Ù |
---|---|
»óÅÂ: | Experimental |
¸ðµâ¸í: | example_module |
¼Ò½ºÆÄÀÏ: | mod_example.c |
¾ÆÆÄÄ¡ ¹èÆ÷º» modules/experimental
µð·ºÅ丮¿¡
ÀÖ´Â ÆÄÀϵéÀº ¾ÆÆÄÄ¡ API¸¦ »ç¿ëÇÏ¿© ¸ðµâÀ» ÀÛ¼ºÇÏ·Á´Â »ç¶÷µéÀ»
µ½±âÀ§ÇÑ ¿¹Á¦´Ù.
mod_example.c
´Â ¸ðµç Äݹé(callback) ±¸Á¶¿Í
È£Ãâ ¹®¹ýÀ» ¼³¸íÇÏ´Â ÆÄÀÏÀÌ´Ù. ´ç½ÅÀº ¸ðµâ¿¡ ÀÌ ¸ðµç ÄݹéÀ»
±¸ÇöÇÒ ÇÊ¿ä°¡ ¾ø´Ù. »ç½Ç Á¤¹Ý´ë´Ù!
example ¸ðµâÀº ½ÇÁ¦·Î µ¿ÀÛÇÏ´Â ¸ðµâÀÌ´Ù. ÀÌ ¸ðµâÀ» ¼¹ö¿¡ ¿¬°áÇÏ°í ƯÁ¤ À§Ä¡¿¡ "example-handler" Çڵ鷯¸¦ ÇÒ´çÇÏ¿© ±×°÷À» ºê¶ó¿ì¡Çϸé example ¸ðµâÀÇ ¿©·¯ ÄݹéÀ» È®ÀÎÇÒ ¼ö ÀÖ´Ù.
¼¹ö¿¡ example ¸ðµâÀ» Æ÷ÇÔÇÏ·Á¸é ´ÙÀ½ °úÁ¤À» °ÅÄ£´Ù:
--enable-example
¿É¼Ç°ú ÇÔ²²
configure
¸¦ ½ÇÇàÇÑ´Ù.make
"¸¦ ½ÇÇàÇÑ´Ù).ÀÚ½ÅÀÌ ¸¸µç ¸ðµâÀ» Ãß°¡ÇÏ·Á¸é:
cp modules/experimental/mod_example.c
modules/new_module/mod_myexample.c
modules/new_module/config.m4
ÆÄÀÏÀ» ¸¸µç´Ù.
APACHE_MODPATH_INIT(new_module)
À»
Ãß°¡ÇÑ´Ù.modules/experimental/config.m4
ÆÄÀÏ¿¡¼
"example"ÀÌ ÀÖ´Â APACHE_MODULE ÁÙÀ» º¹»çÇؿ´Ù.configure --help
¸¦
½ÇÇàÇÏ¸é ¿©±â¿¡ ±â·ÏÇÑ ¼³¸íÀ» º¸¿©ÁØ´Ù.config.m4
ÆÄÀϵéÀ» Âü°íÇ϶ó.APACHE_MODPATH_FINISH
¸¦ Ãß°¡ÇÑ´Ù.module/new_module/Makefile.in
ÆÄÀÏÀ»
¸¸µç´Ù. ¸ðµâÀ» ÄÄÆÄÀÏÇϴµ¥ Ưº°ÇÑ ¸í·É¾î°¡ ÇÊ¿ä¾ø´Ù¸é,
ÆÄÀÏ¿¡ include $(top_srcdir)/build/special.mk
¸¸
À־ µÈ´Ù.mod_example
¸ðµâ »ç¿ëÇϱâexample ¸ðµâÀ» »ç¿ëÇÏ·Á¸é httpd.conf
ÆÄÀÏ¿¡
´ÙÀ½°ú °°Àº ¼³Á¤À» Ãß°¡Ç϶ó:
<Location /example-info>
SetHandler example-handler
</Location>
¾Æ´Ï¸é .htaccess
ÆÄÀÏ¿¡ ´ÙÀ½°ú °°Àº ³»¿ëÀ» Ãß°¡ÇÏ°í, ±× À§Ä¡¿¡¼ "test.example"
°°Àº ÆÄÀÏÀ» ¿äûÇ϶ó:
AddHandler example-handler .example
¼¹ö¸¦ Àç½ÃÀÛÇÑ ÈÄ ÀÌ À§Ä¡¸¦ ºê¶ó¿ì¡ÇÏ¸é ¾Õ¿¡¼ ¸»ÇÑ ³»¿ëÀ» º¸°ÔµÉ °ÍÀÌ´Ù.
¼³¸í: | ¾ÆÆÄÄ¡ ¸ðµâ API¸¦ ¼³¸íÇϱâÀ§ÇÑ ¿¹Á¦ Áö½Ã¾î |
---|---|
¹®¹ý: | Example |
»ç¿ëÀå¼Ò: | ÁÖ¼¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess |
»óÅÂ: | Experimental |
¸ðµâ: | mod_example |
Example
Áö½Ã¾î´Â example ¸ðµâÀÇ
³»¿ëÇڵ鷯°¡ °£´ÜÇÑ ¹®±¸¸¦ º¸ÀÏÁö ¿©ºÎ¸¦ ¼³Á¤ÇÑ´Ù. ÀÌ Áö½Ã¾î´Â
¾Æ±Ô¸ÕÆ®¸¦ ¹ÞÁö¾Ê´Â´Ù. example ³»¿ëÇڵ鷯¸¦ Àû¿ëÇÑ URL¿¡
Á¢¼ÓÇÏ¸é ¹®¼ ¿äûÀ» ¼ºñ½ºÇϱâÀ§ÇØ ¸ðµâ¾È¿¡ ÇÔ¼öµéÀÌ ¾î¶»°Ô
±×¸®°í ¾î¶² ¼ø¼·Î ºÒ¸®´ÂÁö ¾Ë ¼ö ÀÖ´Ù. ÀÌ Áö½Ã¾îÀÇ È¿°ú´Â
"Example directive declared here: YES/NO
"·Î
È®ÀÎÇÒ ¼ö ÀÖ´Ù.