Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?xml version="1.0" encoding="EUC-KR"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head>
<meta content="text/html; charset=EUC-KR" http-equiv="Content-Type" />
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>아파치에서 핸들러 사용 - Apache HTTP Server Version 2.4</title>
<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
<script src="./style/scripts/prettify.min.js" type="text/javascript">
</script>
<link href="./images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="./mod/">모듈</a> | <a href="./mod/directives.html">지시어들</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">용어</a> | <a href="./sitemap.html">사이트맵</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="./images/feather.png" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>아파치에서 핸들러 사용</h1>
<div class="toplang">
<p><span>가능한 언어: </span><a href="./en/handler.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="./es/handler.html" hreflang="es" rel="alternate" title="Español"> es </a> |
<a href="./fr/handler.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="./ja/handler.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="./ko/handler.html" title="Korean"> ko </a> |
<a href="./tr/handler.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="./zh-cn/handler.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
<div class="outofdate">이 문서는 최신판 번역이 아닙니다.
최근에 변경된 내용은 영어 문서를 참고하세요.</div>
<p>이 문서는 아파치에서 핸들러를 사용하는 방법을 설명한다.</p>
</div>
<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#definition">핸들러가 무엇인가</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#examples">예제</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#programmer">프로그래머를 위한 정보</a></li>
</ul><h3>참고</h3><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
<div class="section">
<h2><a name="definition" id="definition">핸들러가 무엇인가</a></h2>
<table class="related"><tr><th>관련된 모듈</th><th>관련된 지시어</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_actions.html">mod_actions</a></code></li><li><code class="module"><a href="./mod/mod_asis.html">mod_asis</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li><li><code class="module"><a href="./mod/mod_imagemap.html">mod_imagemap</a></code></li><li><code class="module"><a href="./mod/mod_info.html">mod_info</a></code></li><li><code class="module"><a href="./mod/mod_mime.html">mod_mime</a></code></li><li><code class="module"><a href="./mod/mod_negotiation.html">mod_negotiation</a></code></li><li><code class="module"><a href="./mod/mod_status.html">mod_status</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_actions.html#action">Action</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#addhandler">AddHandler</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#removehandler">RemoveHandler</a></code></li><li><code class="directive"><a href="./mod/core.html#sethandler">SetHandler</a></code></li></ul></td></tr></table>
<p>파일을 요청할때 아파치가 내부적으로 수행할 작업을
"핸들러(handler)"라고 한다. 일반적으로 파일은 파일 종류에
따라 암묵적인 핸들러를 가지고 있다. 모든 파일은 보통 간단히
서버가 서비스하지만, 어떤 파일 종류는 따로 "처리된다(handled)".</p>
<p>Apache 1.1부터 핸들러를 명시적으로 사용할 수 있게 되었다.
파일 종류와 관계없이 핸들러를 파일의 확장자나 위치에 따라
지정할 수 있다. 이는 더 훌륭한 방법이고 파일을 종류와 핸들러
둘 모두와 연계할 수 있기때문에 좋다. (<a href="mod/mod_mime.html#multipleext">여러 확장자를 가진 파일</a>도
참고)</p>
<p>핸들러는 서버나 모듈로 구현하여, <code class="directive"><a href="./mod/mod_actions.html#action">Action</a></code> 지시어로 추가할
수 있다. 표준 배포본에 있는 기본 핸들러는 다음과 같다:</p>
<ul>
<li><strong>default-handler</strong>: 정적인 내용을
처리하기위해 기본적으로 사용하는 핸들러
<code>default_handler()</code>를 사용하여 파일을 보낸다.
(core)</li>
<li><strong>send-as-is</strong>: HTTP 헤더가 있는 파일을
그대로 보낸다. (<code class="module"><a href="./mod/mod_asis.html">mod_asis</a></code>)</li>
<li><strong>cgi-script</strong>: 파일을 CGI로 처리한다.
(<code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code>)</li>
<li><strong>imap-file</strong>: imagemap 규칙 파일로
처리한다. (<code class="module"><a href="./mod/mod_imagemap.html">mod_imagemap</a></code>)</li>
<li><strong>server-info</strong>: 서버의 설정 정보를
알려준다. (<code class="module"><a href="./mod/mod_info.html">mod_info</a></code>)</li>
<li><strong>server-status</strong>: 서버의 상태를 보고한다.
(<code class="module"><a href="./mod/mod_status.html">mod_status</a></code>)</li>
<li><strong>type-map</strong>: 내용협상에 사용할
type map으로 처리한다.
(<code class="module"><a href="./mod/mod_negotiation.html">mod_negotiation</a></code>)</li>
</ul>
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
<div class="section">
<h2><a name="examples" id="examples">예제</a></h2>
<h3><a name="example1" id="example1">CGI 스크립트를 사용하여 정적인 내용 수정하기</a></h3>
<p>다음 지시어는 확장자가 <code>html</code>인 파일을
요청할 경우 <code>footer.pl</code> CGI 스크립트를 띄운다.</p>
<div class="example"><p><code>
Action add-footer /cgi-bin/footer.pl<br />
AddHandler add-footer .html
</code></p></div>
<p>CGI 스크립트는
(<code>PATH_TRANSLATED</code> 환경변수가 지칭하는) 원래
요청한 문서를 적절히 수정한 후 보낸다.</p>
<h3><a name="example2" id="example2">HTTP 헤더를 포함하는 파일</a></h3>
<p>다음 지시어는 HTTP 헤더를 포함하는 파일에
<code>send-as-is</code> 핸들러를 지시한다.
<code>/web/htdocs/asis/</code> 디렉토리 안에 있는 모든
파일은 확장자와 관계없이 <code>send-as-is</code> 핸들러가
처리한다.</p>
<div class="example"><p><code>
<Directory /web/htdocs/asis><br />
SetHandler send-as-is<br />
</Directory>
</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
<div class="section">
<h2><a name="programmer" id="programmer">프로그래머를 위한 정보</a></h2>
<p>핸들러 기능을 구현하기위해 사용함직한
<a href="developer/API.html">Apache API</a>가 추가되었다.
특히 <code>request_rec</code> 구조체에 새로운 필드가
추가되었다:</p>
<div class="example"><p><code>
char *handler
</code></p></div>
<p>모듈이 핸들러를 사용하려면, 요청의
<code>invoke_handler</code> 단계 이전에
<code>r->handler</code>에 핸들러 이름을 지정해주기만
하면 된다. 핸들러는 content type 대신 핸들러 이름을 사용한
것을 제외하고는 전과 같이 구현되었다. 꼭 지킬 필요는 없지만
핸들러 이름에 슬래쉬를 사용하지 않고, 단어들 사이에 빼기
기호를 사용하는 것이 일반적이다. 그래서 핸들러 이름이
media type과 겹치지 않는다.</p>
</div></div>
<div class="bottomlang">
<p><span>가능한 언어: </span><a href="./en/handler.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="./es/handler.html" hreflang="es" rel="alternate" title="Español"> es </a> |
<a href="./fr/handler.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="./ja/handler.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="./ko/handler.html" title="Korean"> ko </a> |
<a href="./tr/handler.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="./zh-cn/handler.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />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 <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/handler.html';
(function(w, d) {
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2017 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="./mod/">모듈</a> | <a href="./mod/directives.html">지시어들</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">용어</a> | <a href="./sitemap.html">사이트맵</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>