<-
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_example

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

ÀÌ ¹®¼­´Â ÃÖ½ÅÆÇ ¹ø¿ªÀÌ ¾Æ´Õ´Ï´Ù. ÃÖ±Ù¿¡ º¯°æµÈ ³»¿ëÀº ¿µ¾î ¹®¼­¸¦ Âü°íÇϼ¼¿ä.
¼³¸í:¾ÆÆÄÄ¡ ¸ðµâ API¸¦ ¼³¸íÇÑ´Ù
»óÅÂ:Experimental
¸ðµâ¸í:example_module
¼Ò½ºÆÄÀÏ:mod_example.c

¿ä¾à

¾ÆÆÄÄ¡ ¹èÆ÷º» modules/experimental µð·ºÅ丮¿¡ ÀÖ´Â ÆÄÀϵéÀº ¾ÆÆÄÄ¡ API¸¦ »ç¿ëÇÏ¿© ¸ðµâÀ» ÀÛ¼ºÇÏ·Á´Â »ç¶÷µéÀ» µ½±âÀ§ÇÑ ¿¹Á¦´Ù.

mod_example.c´Â ¸ðµç Äݹé(callback) ±¸Á¶¿Í È£Ãâ ¹®¹ýÀ» ¼³¸íÇÏ´Â ÆÄÀÏÀÌ´Ù. ´ç½ÅÀº ¸ðµâ¿¡ ÀÌ ¸ðµç ÄݹéÀ» ±¸ÇöÇÒ ÇÊ¿ä°¡ ¾ø´Ù. »ç½Ç Á¤¹Ý´ë´Ù!

example ¸ðµâÀº ½ÇÁ¦·Î µ¿ÀÛÇÏ´Â ¸ðµâÀÌ´Ù. ÀÌ ¸ðµâÀ» ¼­¹ö¿¡ ¿¬°áÇÏ°í ƯÁ¤ À§Ä¡¿¡ "example-handler" Çڵ鷯¸¦ ÇÒ´çÇÏ¿© ±×°÷À» ºê¶ó¿ì¡Çϸé example ¸ðµâÀÇ ¿©·¯ ÄݹéÀ» È®ÀÎÇÒ ¼ö ÀÖ´Ù.

ÁÖÁ¦

Áö½Ã¾îµé

top

example ¸ðµâ ÄÄÆÄÀÏÇϱâ

¼­¹ö¿¡ example ¸ðµâÀ» Æ÷ÇÔÇÏ·Á¸é ´ÙÀ½ °úÁ¤À» °ÅÄ£´Ù:

  1. --enable-example ¿É¼Ç°ú ÇÔ²² configure¸¦ ½ÇÇàÇÑ´Ù.
  2. ¼­¹ö¸¦ ÄÄÆÄÀÏÇÑ´Ù ("make"¸¦ ½ÇÇàÇÑ´Ù).

ÀÚ½ÅÀÌ ¸¸µç ¸ðµâÀ» Ãß°¡ÇÏ·Á¸é:

  1. cp modules/experimental/mod_example.c modules/new_module/mod_myexample.c
  2. ÆÄÀÏÀ» ¼öÁ¤ÇÑ´Ù.
  3. modules/new_module/config.m4 ÆÄÀÏÀ» ¸¸µç´Ù.
    1. APACHE_MODPATH_INIT(new_module)À» Ãß°¡ÇÑ´Ù.
    2. modules/experimental/config.m4 ÆÄÀÏ¿¡¼­ "example"ÀÌ ÀÖ´Â APACHE_MODULE ÁÙÀ» º¹»çÇؿ´Ù.
    3. ù¹ø° ¾Æ±Ô¸ÕÆ® "example"À» myexample·Î º¯°æÇÑ´Ù.
    4. µÎ¹ø° ¾Æ±Ô¸ÕÆ® ÀÚ¸®¿¡ ÀÚ½ÅÀÌ ¸¸µç ¸ðµâ¿¡ ´ëÇÑ °£´ÜÇÑ ¼³¸íÀ» Àû´Â´Ù. configure --help¸¦ ½ÇÇàÇÏ¸é ¿©±â¿¡ ±â·ÏÇÑ ¼³¸íÀ» º¸¿©ÁØ´Ù.
    5. ¸ðµâÀ» ÄÄÆÄÀÏÇÒ¶§ Ưº°ÇÑ C ÄÄÆÄÀÏ·¯ ¿É¼Ç, ¸µÄ¿ ¿É¼Ç, ¶óÀ̺귯¸®°¡ ÇÊ¿äÇÏ¸é °¢°¢ CFLAGS, LDFLAGS, LIBS¿¡ Ãß°¡ÇÑ´Ù. modules µð·ºÅ丮¿¡ ÀÖ´Â ´Ù¸¥ config.m4 ÆÄÀϵéÀ» Âü°íÇ϶ó.
    6. APACHE_MODPATH_FINISH¸¦ Ãß°¡ÇÑ´Ù.
  4. module/new_module/Makefile.in ÆÄÀÏÀ» ¸¸µç´Ù. ¸ðµâÀ» ÄÄÆÄÀÏÇϴµ¥ Ưº°ÇÑ ¸í·É¾î°¡ ÇÊ¿ä¾ø´Ù¸é, ÆÄÀÏ¿¡ include $(top_srcdir)/build/special.mk¸¸ À־ µÈ´Ù.
  5. ÃÖ»óÀ§ µð·ºÅ丮¿¡¼­ ./buildconf ¸¦ ½ÇÇàÇÑ´Ù.
  6. --enable-myexample ¿É¼ÇÀ» »ç¿ëÇÏ¿© ¼­¹ö¸¦ ÄÄÆÄÀÏÇÑ´Ù
top

mod_example ¸ðµâ »ç¿ëÇϱâ

example ¸ðµâÀ» »ç¿ëÇÏ·Á¸é httpd.conf ÆÄÀÏ¿¡ ´ÙÀ½°ú °°Àº ¼³Á¤À» Ãß°¡Ç϶ó:

<Location /example-info>
SetHandler example-handler
</Location>

¾Æ´Ï¸é .htaccess ÆÄÀÏ¿¡ ´ÙÀ½°ú °°Àº ³»¿ëÀ» Ãß°¡ÇÏ°í, ±× À§Ä¡¿¡¼­ "test.example" °°Àº ÆÄÀÏÀ» ¿äûÇ϶ó:

AddHandler example-handler .example

¼­¹ö¸¦ Àç½ÃÀÛÇÑ ÈÄ ÀÌ À§Ä¡¸¦ ºê¶ó¿ì¡ÇÏ¸é ¾Õ¿¡¼­ ¸»ÇÑ ³»¿ëÀ» º¸°ÔµÉ °ÍÀÌ´Ù.

top

Example Áö½Ã¾î

¼³¸í:¾ÆÆÄÄ¡ ¸ðµâ API¸¦ ¼³¸íÇϱâÀ§ÇÑ ¿¹Á¦ Áö½Ã¾î
¹®¹ý:Example
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤, °¡»óÈ£½ºÆ®, directory, .htaccess
»óÅÂ:Experimental
¸ðµâ:mod_example

Example Áö½Ã¾î´Â example ¸ðµâÀÇ ³»¿ëÇڵ鷯°¡ °£´ÜÇÑ ¹®±¸¸¦ º¸ÀÏÁö ¿©ºÎ¸¦ ¼³Á¤ÇÑ´Ù. ÀÌ Áö½Ã¾î´Â ¾Æ±Ô¸ÕÆ®¸¦ ¹ÞÁö¾Ê´Â´Ù. example ³»¿ëÇڵ鷯¸¦ Àû¿ëÇÑ URL¿¡ Á¢¼ÓÇÏ¸é ¹®¼­ ¿äûÀ» ¼­ºñ½ºÇϱâÀ§ÇØ ¸ðµâ¾È¿¡ ÇÔ¼öµéÀÌ ¾î¶»°Ô ±×¸®°í ¾î¶² ¼ø¼­·Î ºÒ¸®´ÂÁö ¾Ë ¼ö ÀÖ´Ù. ÀÌ Áö½Ã¾îÀÇ È¿°ú´Â "Example directive declared here: YES/NO"·Î È®ÀÎÇÒ ¼ö ÀÖ´Ù.

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

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.