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