<-
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.
Comments are disabled for this page at the moment.