1
0
mirror of https://github.com/apache/httpd.git synced 2025-04-18 22:24:07 +03:00
apache/docs/manual/custom-error.xml.ko
Lucien Gentis 1281637d8d Rebuild.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1742728 13f79535-47bb-0310-9956-ffa450edef68
2016-05-07 16:29:46 +00:00

187 lines
6.3 KiB
XML

<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.ko.xsl"?>
<!-- English Revision: 420990:1741842 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manualpage metafile="custom-error.xml.meta">
<title>사용자정의 오류 응답</title>
<summary>
<p>웹마스터는 오류나 문제가 발생했을때 아파치의 응답을
설정할 수 있다.</p>
<p>서버가 오류나 문제를 발견했을때 보낼 사용자정의 응답을
정의할 수 있다.</p>
<p>스크립트가 죽은 경우 "500 Server Error" 응답 대신 사용자에게
더 친근한 문구를 사용하거나 다른 (같은 사이트나 외부 사이트의)
URL로 리다이렉션을 할 수 있다.</p>
</summary>
<section id="behavior">
<title>행동</title>
<section>
<title>이전 행동</title>
<p>NCSA httpd 1.3은 사용자에게 무의미하고 지루한 오류문을
보냈다. 문제가 발생한 이유를 로그에 남길 수도 없었다.</p>
</section>
<section>
<title>새로운 행동</title>
<p>서버는 다음과 같은 일을 할 수 있다:</p>
<ol>
<li>NCSA의 고정된 문구 대신 다른 문구를 보여주거나</li>
<li>같은 사이트의 URL로 리다이렉션하거나</li>
<li>외부 사이트의 URL로 리다이렉션한다.</li>
</ol>
<p>다른 사이트의 URL로 리다이렉션하는 것이 유용할 수 있지만,
이 경우 문제를 설명하거나 로그하는데 필요한 정보중 일부만
전달된다.</p>
<p>오류에 대한 정보를 전달하기위해 아파치는 CGI식의 새로운
환경변수를 정의한다:</p>
<example>
REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap,
image/jpeg<br />
REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05
9000/712)<br />
REDIRECT_PATH=.:/bin:/usr/local/bin:/etc<br />
REDIRECT_QUERY_STRING=<br />
REDIRECT_REMOTE_ADDR=121.345.78.123<br />
REDIRECT_REMOTE_HOST=ooh.ahhh.com<br />
REDIRECT_SERVER_NAME=crash.bang.edu<br />
REDIRECT_SERVER_PORT=80<br />
REDIRECT_SERVER_SOFTWARE=Apache/0.8.15<br />
REDIRECT_URL=/cgi-bin/buggy.pl
</example>
<p><code>REDIRECT_</code> 접두사에 주목하라.</p>
<p>최소한 <code>REDIRECT_URL</code>
<code>REDIRECT_QUERY_STRING</code>은 (cgi-script나
cgi-include일) 새 URL로 넘겨진다. 다른 변수는 오류가
발생하기 이전에 <transnote>이름에서 <code>REDIRECT_</code>
뺀 환경변수가</transnote> 존재한 경우에만 있다.
<directive module="core">ErrorDocument</directive>
<em>외부로</em> (같은 서버라도 <code>http:</code>
같은 스킴(scheme)으로 시작한다면) 리다이렉션한다면
이중 어떤 것도 설정되지 <strong>않는다</strong>.</p>
</section>
</section>
<section id="configuration">
<title>설정</title>
<p><directive module="core">AllowOverride</directive>
적절히 설정되었다면 .htaccess 파일에서
<directive module="core">ErrorDocument</directive>를 사용할
수 있다.</p>
<p>다음은 예이다...</p>
<example>
ErrorDocument 500 /cgi-bin/crash-recover <br />
ErrorDocument 500 "Sorry, our script crashed. Oh dear" <br />
ErrorDocument 500 http://xxx/ <br />
ErrorDocument 404 /Lame_excuses/not_found.html <br />
ErrorDocument 401 /Subscription/how_to_subscribe.html
</example>
<p>문법은,</p>
<example>
ErrorDocument &lt;3-digit-code&gt; &lt;action&gt;
</example>
<p>가능한 action은,</p>
<ol>
<li>출력할 문구. 따옴표 (")를 문구 앞에 붙인다. 뒤에 나오는
따옴표는 출력된다. <em>주의: 앞에 붙은 따옴표 (")는 출력되지
않는다.</em></li>
<li>리다이렉션할 외부 URL.</li>
<li>리다이렉션할 내부 URL.</li>
</ol>
</section>
<section id="custom">
<title>사용자정의 오류 응답과 리다이렉션</title>
<p>URL로 리다이렉션하는 아파치 행동은
스크립트/server-include에 환경변수를 더 넘겨주도록 변경되었다.</p>
<section>
<title>이전 행동</title>
<p>리다이렉션되는 스크립트에 표준 CGI 변수들이 넘어간다.
어디에서 리다이렉션이 일어났는지 알 수 없다.</p>
</section>
<section>
<title>새로운 행동</title>
<p>리다이렉션된 스크립트는 새로운 환경변수들을 사용할
수 있다. 모두 앞에 <code>REDIRECT_</code>가 붙어있다.
<code>REDIRECT_</code> 환경변수는 원래 CGI 환경변수명
앞에 <code>REDIRECT_</code>를 붙여서 만든다. <em>예를
들어</em>, <code>HTTP_USER_AGENT</code>
<code>REDIRECT_HTTP_USER_AGENT</code>가 되었다. 이런 변수에
추가로 스크립트가 원래 URL을 알도록 아파치는
<code>REDIRECT_URL</code><code>REDIRECT_STATUS</code>
정의한다. 원래 URL과 리다이렉션된 URL 모두 접근 로그에
기록할 수 있다.</p>
<p>ErrorDocument가 같은 서버에 있는 CGI 스크립트로
리다이렉션한다면, 스크립트는 클라이언트에게 오류 상황을
확실히 전달하기위해 출력에 "<code>Status:</code>" 헤더
필드를 포함해야 한다. 예를 들어, Perl로 작성한 ErrorDocument
스크립트는 다음과 같다:</p>
<example>
... <br />
print "Content-type: text/html\n"; <br />
printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"}; <br />
...
</example>
<p><code>404&nbsp;Not&nbsp;Found</code>와 같은 특정 오류
상황에 대한 스크립트라면, 대신 <transnote>고정된</transnote>
특정 상태코드와 오류문을 사용할 수 있다.</p>
<p>(클라이언트에게 리다이렉션을 요청하기위해) 응답에
<code>Location:</code> 헤더를 포함한다면, 스크립트는
<em>반드시</em> (<code>302&nbsp;Found</code> 같은) 적절한
<code>Status:</code> 헤더를 출력해야 함을 주의하라. 그렇지않으면
<code>Location:</code> 헤더가 아무 소용없게 될 수 있다.</p>
</section>
</section>
</manualpage>