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
"로
확인할 수 있다.